mirror of
https://github.com/minetest-mods/mesecons.git
synced 2025-07-05 00:50:24 +02:00
Something works
This commit is contained in:
@ -11,11 +11,39 @@ end
|
||||
|
||||
local f_init = load_lib("_init")
|
||||
local f_fini = load_lib("_fini")
|
||||
local f_helpers = load_lib("helpers")
|
||||
local f_serialize = load_lib("serialize")
|
||||
local l_helpers = load_lib("helpers")
|
||||
local l_serialize = load_lib("serialize")
|
||||
local c_test = load_lib("test")
|
||||
|
||||
print("Testing")
|
||||
local a,b,c,d,e,f = libluabox.run(0.1, 128, f_helpers, f_serialize, f_init, c_test, f_fini)
|
||||
print(a,b,c,d,e,f)
|
||||
print("Tested")
|
||||
local function b(value)
|
||||
if value then
|
||||
return "true"
|
||||
end
|
||||
return "false"
|
||||
end
|
||||
|
||||
local function serialize_ports(key, port)
|
||||
return string.format("%s = {a=%s, b=%s, c=%s, d=%s}", key, b(port.a), b(port.b), b(port.c), b(port.d))
|
||||
end
|
||||
|
||||
function mesecons_sandbox.run(pin, port, mem, code)
|
||||
print("Old ports:", dump(port))
|
||||
print("Old memory:", mem)
|
||||
print("Code:", code)
|
||||
local ok, port, mem, log = libluabox.run(1.0, 128, l_helpers, l_serialize,
|
||||
serialize_ports("pin", pin),
|
||||
serialize_ports("port", port),
|
||||
mem,
|
||||
f_init, code, f_fini)
|
||||
print(minetest.serialize({ok, port, mem, log}))
|
||||
if ok then
|
||||
print("New memory:", mem)
|
||||
print("New ports:", port)
|
||||
end
|
||||
if log then
|
||||
print("Log: <<<")
|
||||
print(log)
|
||||
print(">>>")
|
||||
end
|
||||
return ok, minetest.deserialize(port, true), (mem or "")
|
||||
end
|
||||
|
Reference in New Issue
Block a user