2025-06-25 13:25:48 -04:00
|
|
|
-- This file should only be used for globally useful constants and functions.
|
|
|
|
-- Please put new events, actions, items, etc. in their respective 'main' Lua files.
|
2025-06-21 12:23:25 -04:00
|
|
|
|
2025-05-06 21:57:52 -04:00
|
|
|
function split(input, separator)
|
|
|
|
if separator == nil then
|
|
|
|
separator = '%s'
|
|
|
|
end
|
|
|
|
|
|
|
|
local t = {}
|
|
|
|
for str in string.gmatch(input, '([^'..separator..']+)') do
|
|
|
|
table.insert(t, str)
|
|
|
|
end
|
|
|
|
|
|
|
|
return t
|
|
|
|
end
|
|
|
|
|
2025-06-25 15:21:09 -04:00
|
|
|
function getTableSize(tbl)
|
|
|
|
local count = 0
|
|
|
|
|
|
|
|
for _, _ in pairs(tbl) do
|
|
|
|
count = count + 1
|
|
|
|
end
|
|
|
|
|
|
|
|
return count
|
|
|
|
end
|
|
|
|
|
2025-06-25 16:52:37 -04:00
|
|
|
function printf(player, fmt_str, ...)
|
|
|
|
-- Sender would be defined elsewhere, if at all
|
2025-06-25 18:24:21 -04:00
|
|
|
if command_sender == nil then
|
|
|
|
command_sender = ""
|
2025-06-25 16:52:37 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
if ... ~= nil then
|
2025-06-25 18:24:21 -04:00
|
|
|
player:send_message(command_sender..fmt_str:format(...))
|
2025-06-25 16:52:37 -04:00
|
|
|
else
|
2025-06-25 18:24:21 -04:00
|
|
|
player:send_message(command_sender..fmt_str)
|
2025-06-25 16:52:37 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2025-06-20 09:27:37 -04:00
|
|
|
-- Constants
|
|
|
|
GM_RANK_NORMALUSER = 0
|
|
|
|
GM_RANK_GAMEMASTER = 1
|
|
|
|
GM_RANK_EVENTJUNIOR = 3
|
|
|
|
GM_RANK_EVENTSENIOR = 4
|
|
|
|
GM_RANK_SUPPORT = 5
|
|
|
|
GM_RANK_SENIOR = 7
|
|
|
|
GM_RANK_DEBUG = 90
|
|
|
|
GM_RANK_MAX = 255 -- Doesn't exist, used for purposes of testing permissions in scripts
|