celludriel Posted June 15, 2017 Share Posted June 15, 2017 I added a setGlobal in one script that runs on server startup, then tried using that global in a script attached to a script with getGlobal. But its always nil Are those globals just global in one script run, or are they global over the game instance ? If they are just global in one script run, I'm so very very boned .... Link to comment Share on other sites More sharing options...
celludriel Posted June 15, 2017 Author Share Posted June 15, 2017 Aaargh this is frustrating, you can't use an array as a global variable {}. This sucks , it's one of the most important things you want an associative array you can use as context to reach in your entire application. Think springbeans in the springcontext if you would talk java. Or just basic IOC design in any other programming language .... grmbl ... I guess I could work with tons of prefixed variables in the global array as string ... but that is just messy ... Link to comment Share on other sites More sharing options...
Laserzwei Posted June 16, 2017 Share Posted June 16, 2017 you could convert your array to a single string and store it in a global variable. Link to comment Share on other sites More sharing options...
celludriel Posted June 16, 2017 Author Share Posted June 16, 2017 I did I'm using a Json library now http://dkolf.de/src/dkjson-lua.fsl/home It works but I lose some flexibility and some overhead decoding and encoding the json. We are devs we always find workarounds, doesn't mean we have to like them though. Not even fond on having to use globals ... it's not like they act as singletons ... Link to comment Share on other sites More sharing options...
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