joker.neophyte Posted June 28, 2013 Share Posted June 28, 2013 Hello. First, I tried putting all I needed into _G in all my different resources, thinking that I could use it to share stuff beetween them (_G.root = getRootElement(), etc..). It obviously didn't work. Then, I tried putting everything in one resource, using dofile() to load my scripts from subdirectories which got me an error message about it being an unsafe function. So the question I'd like to ask is this: is there ANY way at all to share things beetween resources without using meta.xml? I don't want to write 350 lines of (and if I see it right on the wiki, it doesn't even work with variables) and a monolithic file is unmaintainable. Any ideas? Link to comment
fmj02 Posted June 28, 2013 Share Posted June 28, 2013 (edited) You can't share variables, only functions using call or exports.resource:exportedFunction(...) this is the only way, to allow calling from other resource you have to export it first in meta. Here is more. EDIT: you can try to make a function getVariables that will return _G table and export it. Edited June 28, 2013 by Guest Link to comment
ixjf Posted June 28, 2013 Share Posted June 28, 2013 You can always wait for MTA:Eir - it will use one single global Lua virtual machine for all resources. Link to comment
Vector Posted June 29, 2013 Share Posted June 29, 2013 https://forum.multitheftauto.com/viewtopic.php?f=148&t=61058&sid=b58333014f5ecf31ee4f74d9af856049 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now