The first solution would be to import it globally but from a performance point of view this may not be the best.
The second solution would be to import it locally into each script that uses it, but that will quickly be heavy on memory, I told myself.
And so the third thing I thought would be to import it locally in the 'main.lua' then pass it as a parameter (therefore as a reference) to my objects a bit like this:
Code: Select all
function myObject:new(g3d)
self = setmetatable({}, myObject)
self.g3d = g3d
return self
end