The best way to share player data across scripts

Place to get help with not working mods / modding interface.
User avatar
durodur
Manual Inserter
Manual Inserter
Posts: 4
Joined: Wed May 02, 2018 10:34 pm
Contact:

The best way to share player data across scripts

Post 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
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: The best way to share player data across scripts

Post 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).
Post Reply

Return to “Modding help”