References
So the engine has Object right. And Lua has this thing called the garbage collector that does automatic memory management. The engine owns the fields within Object, and the lua context should never try to release them because otherwise that interferes with the engine’s ability to operate. So the engine needs to ensure that this garbage collector does not release any of those fields. The solution we go with is “references”: wrappers around certain types that are used identically to their regular types, but they are set up to never get dropped.
For the most part, this is only relevant at a low level, such to the point where this page would be useless. References carry the same methods/fields with their non-reference counterparts, and the same behavior, and thus there is no difference. However, because they are technically different types internally, there is going to be a known bug where certain engine functions will reject the reference types. Said engine functions are few and far between, especially since, again, this rule doesn’t apply to any methods of the classes. The one that comes to mind as of writing this, for example, is Renderer:draw_texture_opt; if you find yourself calling this function you must do it with a TextureOptions that You created, NOT Object.texture_options, otherwise you will get an error because that is a reference.
And this is why future projects I work on I will search for a different scripting language other then Lua if we need it :) or we’ll just write in native code haha idfk