• 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!

Lua Overwritting global variable

Keraxel

Ω Obfuscator Ω
Joined
Feb 2, 2008
Messages
941
Reaction score
5
Location
Republic of Poland
Hi Otlanders,
Is Anyone got an idea how to overwrite global variable in lua? I try to add Player's cid to function this way, that I'll be able to read it from other function.

It looks like that:

lua table:
Lua:
ctf = {flaggers = {}}

function in data/lib:
Lua:
...
print(table.insert(ctf.flaggers, cid))
print(#ctf.flaggers) -- prints 1
...

globalevent printing size of table each second:
Lua:
<globalevent name="markCtfFlagger" interval="1" event="script"><![CDATA[
	function onThink(interval, lastExecution)
		return print(#ctf.flaggers) --always prints 0
]]></globalevent>

I'll hope someone knows the solution.

Regards,
Keraxel.
 
use globalstorage with explode / split - its only way I know. Anyway, why you need list of ctf players for ?
 
use globalstorage with explode / split - its only way I know. Anyway, why you need list of ctf players for ?

If I would use storage then it would be player storage instead of global. I dont want to check every player for flag, this is why I thought about table. I think concatenating wouldn't be good solution.
 
Lua:
_G = {}
The same effect

Lua:
_G = {FLAGGERS = {}}
Still the same effect

kef :S
It shouldn't be like u posted.

Code:
_G['FRAGERS'] = {}

Then:
Code:
table.insert(_G['FRAGERS'], XXXX)

Code:
return #_G['FRAGERS']

Still not sure if it'll work.
 
Back
Top