• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua save/get table values in different files

NewMan

New Member
Joined
Jun 22, 2013
Messages
8
Reaction score
0
Hi, sorry for my english.

My question is... Is there any way to save values in a table inside an script and then get these values in another script?

example of what I do and the result i get:
I have a variable in functions:
tableName = {}

then in another script (action script, onUse an item), i insert cid's name in this table:
table.insert(tableName, getCreatureName(cid))

'Then if I print the result of the tableName in functions or in this actions everything is Ok, but if I try to get this value in another script (movement), this table is returned as empty...

Any1 knows why?

Thanks.
 
Here's one thing you could try but not guaranteed to work, create that table in global.lua or whatever (lib/...) then use it in both scripts.
It's not guaranteed to work because I think scripts are ran in sandbox so every script interface runs in it's lua enviroment (action, etc...) to avoid them you'd need some C++ knowledge; make the lua_State static in the LuaInterface class or whatever it was, ScriptEnviroment? but that _may_ (about 30%) introduce new bugs.
 
Back
Top