Page 1 of 1

The best way to share player data across scripts

Posted: Sun May 13, 2018 1:48 pm
by durodur
Hi, I'm making a mod which requires an extra data flag (string or enum) to be attached to players. Is it possible to store an array of this flag (and a corresponding array of player_index to map the two) that can be used across scripts in control.lua, or is there some way I can use flags in a LuaPlayer entity to store this information. Note that I can't use the LuaEntity LuaPlayer.character for this because these flags need to be stored after the players die.

Thanks in advance,
durodur

Re: The best way to share player data across scripts

Posted: Sun May 13, 2018 8:05 pm
by eradicator
durodur wrote:that can be used across scripts in control.lua,
Across what?
Functions? Modules?
-> store in global http://lua-api.factorio.com/latest/Data-Lifecycle.html
Mods?
-> use remote interface http://lua-api.factorio.com/latest/LuaRemote.html

For better answers you need to ask more precise questions ;p. (and preferably small bits of code you're having problems with).