• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved [advanced] Global table?

nclx

Member
Joined
Jul 18, 2009
Messages
554
Reaction score
15
Hello I'm needing a global table and this is what is happening:

I make global a = {} in /data/test.lua
/data/global.lua imports /data/test.lua

a globalevent calls /data/test.lua function that modifies a.

printing any value of table a from talkaction gives the modified value.

creaturescript onPrepareDeath calls any value of the table a and is not modified.

why the fuck creaturescript doesnt show the modified value? does it has something to do with login.lua registering the onpreparedeath event?
 
Most scripts (at least in TFS) run in isolated LUA environments which have no access to each other.
Either you have to rewrite the LUA handling in TFS or you have to use some kind of shared space, like MySQL or a creature/an item on the map where you can attach properties which are available for every script.
 
You could possibly use global storage, use the global event to set a value in the storage then call it on the players death with a table in the creaturescript that perceives each value as an action
 
Storage (either global or player) doesn't support tables and I've already re-made my system using other method, alternative ways are no needed, just wanted to know why it wasn't working, thanks anyway.

The thread is solved and should be closed :/
 
Back
Top