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:
@@ -1,4 +1,14 @@
|
|||||||
function data_handle(data)
|
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("([^=]+)=([^=]+)")
|
local cmd, value = data:match("([^=]+)=([^=]+)")
|
||||||
if cmd == nil and data:sub(-1) == "=" then
|
if cmd == nil and data:sub(-1) == "=" then
|
||||||
cmd = data:sub(1, -2)
|
cmd = data:sub(1, -2)
|
||||||
|
|||||||
Reference in New Issue
Block a user