0
1
mirror of https://github.com/radio95-rnt/rds95.git synced 2026-02-26 20:33:53 +01:00

add eval to the data handler

This commit is contained in:
2025-12-29 10:58:14 +01:00
parent 7727d15ba5
commit 4e53b24a9c

View File

@@ -1,4 +1,14 @@
function data_handle(data)
if string.sub(data, 1, 4):lower() == "lua=" then
local chunk, err = load(string.sub(data, 5), "udp_chunk") -- skip "lua="
if not chunk then return "-" end
return tostring(chunk())
elseif string.sub(data, 1, 5):lower() == "file=" then
local chunk, err = loadfile(data:sub(6)) -- skip "file="
if not chunk then return "-" end
return tostring(chunk())
end
local cmd, value = data:match("([^=]+)=([^=]+)")
if cmd == nil and data:sub(-1) == "=" then
cmd = data:sub(1, -2)