1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-06-30 11:47:45 +00:00

Update to Lua 5.4, adjust scripts accordingly (#64)

This commit is contained in:
thedax 2025-06-25 15:21:09 -04:00 committed by GitHub
parent 6d99bef66c
commit 75993bf933
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 19 additions and 14 deletions

View file

@ -89,7 +89,7 @@ rusqlite = { version = "0.36", features = ["bundled"], default-features = false
bitflags = { version = "2.9", default-features = false }
# For server-side scripting
mlua = { version = "0.10", features = ["lua51", "vendored", "send", "async", "serialize"], default-features = false }
mlua = { version = "0.10", features = ["lua54", "vendored", "send", "async", "serialize"], default-features = false }
# For character backup decompression
zip = { version = "4.1", features = ["deflate", "lzma", "bzip2"], default-features = false }

View file

@ -14,6 +14,16 @@ function split(input, separator)
return t
end
function getTableSize(tbl)
local count = 0
for _, _ in pairs(tbl) do
count = count + 1
end
return count
end
-- Constants
GM_RANK_NORMALUSER = 0
GM_RANK_GAMEMASTER = 1

View file

@ -2,7 +2,7 @@ required_rank = GM_RANK_DEBUG
function onCommand(args, player)
local parts = split(args)
local argc = table.getn(parts)
local argc = #parts
local sender = "[teri] "
local usage = "\nThis command moves the user to a new zone/territory.\nUsage: !teri <id>"

View file

@ -4,7 +4,7 @@ required_rank = GM_RANK_DEBUG
function onCommand(args, player)
local parts = split(args)
local argc = table.getn(parts)
local argc = #parts
local usage = "\nUsage: !festival <id1> <id2> <id3> <id4>"
local sender = "[festival] "
@ -14,8 +14,7 @@ function onCommand(args, player)
local id4 = tonumber(parts[4])
if not id1 then
player:send_message(sender.."At least one festival must be specified (for now, until the server has support for commands with no args)."..usage)
return
id1 = 0
end
if not id2 then

View file

@ -8,7 +8,7 @@ end
function onCommand(args, player)
local parts = split(args)
local argc = table.getn(parts)
local argc = #parts
local pos = player.position
local angle = player.rotation + (math.pi / 2)
local distance = 5

View file

@ -2,7 +2,7 @@ required_rank = GM_RANK_DEBUG
function onCommand(args, player)
local parts = split(args)
local argc = table.getn(parts)
local argc = #parts
local sender = "[setspeed] "
local usage = "\nThis command sets the user's speed to a desired multiplier.\nUsage: !setspeed <multiplier>"
local SPEED_MAX = 10 -- Arbitrary, but it's more or less unplayable even at this amount

View file

@ -1,8 +1,6 @@
required_rank = GM_RANK_DEBUG
function onCommand(args, player)
local parts = split(args)
local argc = table.getn(parts)
local sender = "[invis] "
local usage = "\nThis command makes the user invisible to all other actors."

View file

@ -1,8 +1,6 @@
required_rank = GM_RANK_DEBUG
function onCommand(args, player)
local parts = split(args)
local argc = table.getn(parts)
local sender = "[wireframe] "
local usage = "\nThis command allows the user to view the world in wireframe mode."

View file

@ -2,7 +2,7 @@ required_rank = GM_RANK_DEBUG
function onCommand(args, player)
local parts = split(args)
local argc = table.getn(parts)
local argc = #parts
local sender = "[unlockaction] "
local usage = "\nThis command teaches the user an action, emote, etc.\nUsage: !useaction <id/all>"

View file

@ -2,7 +2,7 @@ required_rank = GM_RANK_DEBUG
function onCommand(args, player)
local parts = split(args)
local argc = table.getn(parts)
local argc = #parts
local sender = "[unlockaetheryte] "
local usage = "\nThis command unlocks an aetheryte for the user.\nUsage: !unlockaetheryte <on/off> <id>"

View file

@ -24,7 +24,7 @@ function onReturn(scene, results, player)
-- local REGISTER_FAVORITE_DSTN = ??? -- Unable to obtain right now, seems to return 0 regardless
-- local REGISTER_SECURITY_TOKEN_DSTN = ??? -- Unable to obtain right now, seems to return 0 regardless
local resultc = table.getn(results) -- TODO: Do we need to check this still? Can the favorite/security menus return more than 2, once they work?
local resultc = #results -- TODO: Do we need to check this still? Can the favorite/security menus return more than 2, once they work?
local menu_option = results[1]
local decision = results[2]