System structure
⛔️ WARNING!
If you are not familiar with how to use these functions, it is strongly recommended not to use them, as incorrect usage may lead to serious issues!
OS / System functions
These are direct Lua os functions. Use with extreme care.
os.execute(command) -- Run a system command (dangerous!)
os.time() -- Current time (seconds since epoch)
os.clock() -- CPU time used by program
os.date(format, time) -- Format date/time
os.getenv(varname) -- Read environment variable
os.remove(path) -- Delete file
os.rename(old, new) -- Rename/move file
os.setlocale(locale) -- Change locale
os.exit(code) -- Terminate processTimers
GrowSoft adds a safe timer system so you don’t need to manage your own loops.
timer.setTimeout
Runs a function once after a delay (in seconds).
local id = timer.setTimeout(2.0, function(player, text)
print(player:getName() .. " " .. text)
end, some_player, "Hello there")- First argument: delay in seconds (
2.0). - Second: callback function.
- Remaining arguments: passed into the callback.
timer.setInterval
Runs a function repeatedly every N seconds until cleared.
local id = timer.setInterval(1.0, function()
print("Tick")
end)To stop it:
timer.clear(id)Safe usage pattern (very important)
❌ Bad — capturing full player object inside a delayed timer:
onPlayerDisconnectCallback(function(player)
timer.setTimeout(5.0, function(my_player)
print(my_player:getName()) -- Player may no longer exist
end, player)
end)✅ Good — store only userID, then re-fetch with getPlayer:
onPlayerDisconnectCallback(function(player)
local uid = player:getUserID()
timer.setTimeout(5.0, function(my_player_id)
local p = getPlayer(my_player_id)
if p ~= nil then
print(p:getName())
end
end, uid)
end)If your callback runs after the player disconnects,
getPlayer(id)will simply returnnil, which is safe.
Text parsing helper
parseText converts key|value lines into a table for easy access.
local data = parseText([[
something|blabla
blabla|something
]])
print(data["something"]) -- "blabla"
print(data["blabla"]) -- "something"This is especially useful when parsing packed strings from dialogs, HTTP responses, or raw packets.