Hello Cfx Team and the Community,
As it has already been mentioned many times it is impossible to share the metatables of a Lua object between scripts, and this includes the choices to go through exports and events (to name only the main ones), in any case I do not not here to start a discussion on this specific isolation which is basically not a bad thing
In a topic involving PichoM & d-bubble in a really intersting discussion, d-bubble mentioned that metatable references have already been planned (is this still the case ?).
After reflection, I was wwondering if it’s was possible to allow through the fxmanifest a way to list all the files wich could reprensets library files to be imported from a script and to allow in some way to add in the files to load, to a script all the files that would have been imported.
This could take the form of an fximport.lua file at the root of the script and which would only contain a table with 3 indexed table witch represents each one a scope with the list of files return through the import function described after :
{
share = { "file1.lua", "file2.lua" },
server = { "file4.lua" },
client= { "file3.lua" }
}
and the specified function available in the fxmanifest.lua with a result handled through the script loading line:
shared_scripts(import("MyScript"))
And the code behind the shared_scripts function would directly take the right “sub table”
Thanks for your time,
Doggy