PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Shurlock on 01 July, 2005, 18:11:48

Title: Load and save table(s)
Post by: Shurlock on 01 July, 2005, 18:11:48
Hi all!

Seems I need some help saving and loading a table.
The table within code below works just fine, but I need to have the table saved at exit and loaded at scriptrestart.

I'd be very gratefull to get it working!!

-- PASSIVE.LUA
-- Keeps the number of Passive users limited to

Passive = { "Non-Registered Passive Users" }
MaxPassive = 100

function NewUserConnected(curUser)
if strfind(curUser.sMyInfoString, "M:P") then
if getn(Passive) > MaxPassive then
curUser:SendData("\r\n\r\n\t*** Sorry, but we do not allow more than "..MaxPassive.." PASSIVE users in the hub.\r\n\t*** Please try again later.\r\n")
curUser:Disconnect()
return 1
else
tinsert(Passive, curUser.sName)
-- Report the Passive Users  (debug function)
for index=1,getn(Passive) do
SendToAll("\r\n\tArray["..index.."]\t"..Passive[index])
end
end
end
end

(Script is to be used in LUA4)