• 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 After 20 minutes, a function is returning a unexpected value.

devianceone

Lua Scripter
Joined
Jan 24, 2009
Messages
756
Reaction score
28
I have a problem, I'm writing a script that uses a global event, activated every 2 seconds which has a check to see if a event is active or not before executing the code..
Code:
	if tpIsActive() == false or tpIsWaiting() == true then
		return true
	end
tpIsActive() was at first was the code below, always returning true if I had my global storage set to 1 or higher, else sending false.
Code:
return getStorage(ThePlague.Config.gsGameIsActive) > 0

After about 15-20 minutes, I always get a error about attempting to compare a string to a bool, this means tpIsActive, which should always return a bool, returned a string instead.

I changed the code up to see what was happening and set it to
Code:
function tpIsActive()
	local isActive = getStorage(ThePlague.Config.gsGameIsActive)
	if type(isActive) == "number" then
		if tonumber(isActive) >= 1 then
			return true
		else
			return false
		end
	else
		print("[ THE PLAGUE ] Error: isActive returned a non number! [" .. tostring(isActive) .. ", type: " .. tostring(type(isActive)) .. "]")
		return false
	end

	return false
end
Again, after 20 minutes I got my error message, it was a string containing weird characters.
Code:
[ THE PLAGUE ] Error: isActive returned a non number! [└ -, type: string]

Can anyone explain to me whats going on? Why does grabbing global storages, or functions sometimes return a string to me usually at the 15-20 minute mark? The script will work fine after I handle the potential errors, functions return values as normal.

0.4dev, r3884
 
chris server event

This uses no code of yours, you're welcome to try it out if you want, drop me a pm. It doesn't involve any pvp, teams or scoring system like KoH. The only thing it has in common is the fact is uses a waiting room and an 'arena' room.
 
nah i wasnt talking about it, but koh got the samme issue, global storages returning unecpected values after some time, didnt meant anything else p:

 
Back
Top