I've seen Storage used a lot in scripts, but I'm still not sure what can be stored in them. Some background info and questions below.
Note: I don't expect complete answers to all the questions at once. If anyone can answer one or two of them please do so.
As far as I can figure out:
Q2. Is there anything inaccurate in what I wrote above (excluding what can be stored - i.e. Q1)?
I've never seen global variable used in a script, but I read a post in one of the technical forums written by someone who'd done a performance test on them (he said they're 6x faster than Storage). The same article said that there are multiple distinct Lua runtime contexts, suggesting that it's not possible to use standard Lua facilities to communicate between scripts (not a serious functional restriction because of Storage)
Q3. Are there in fact multiple separate Lua contexts in TFS 1.0?
Q4. Can a global variable hold a Lua Table?
Q5. Is there a way to have the game store the values of global variables to disk?
Q6. Is there an API for TFS 1.0 global variables?
Note: I don't expect complete answers to all the questions at once. If anyone can answer one or two of them please do so.
As far as I can figure out:
- There's "player-centric" storage, which uses the player's creatureId and an integer between 1 and 65K to index storage slots - so 64K different slots are available per player. I've only seen integer values stored in these.
- There's game-level storage, which has a single key, presumably also an integer in the range 1-64, so 64K extra slots in total.
- The game will save Storage values whenever the game state is saved if a parameter is set for this parameter saveGlobalStorage in config.lua is set to "yes".
Q2. Is there anything inaccurate in what I wrote above (excluding what can be stored - i.e. Q1)?
I've never seen global variable used in a script, but I read a post in one of the technical forums written by someone who'd done a performance test on them (he said they're 6x faster than Storage). The same article said that there are multiple distinct Lua runtime contexts, suggesting that it's not possible to use standard Lua facilities to communicate between scripts (not a serious functional restriction because of Storage)
Q3. Are there in fact multiple separate Lua contexts in TFS 1.0?
Q4. Can a global variable hold a Lua Table?
Q5. Is there a way to have the game store the values of global variables to disk?
Q6. Is there an API for TFS 1.0 global variables?
Last edited: