Template
1
0
mirror of https://github.com/bol-van/zapret2.git synced 2026-03-22 01:05:48 +00:00

move basic desync functions to zapret-lib.lua

This commit is contained in:
bol-van
2025-11-25 16:34:18 +03:00
parent 35b97450fe
commit 39c6a71481
3 changed files with 36 additions and 30 deletions

View File

@@ -70,35 +70,6 @@ standard ipfrag :
]]
-- execute given lua code. "desync" is temporary set as global var to be accessible to the code
-- useful for simple fast actions without writing a func
-- arg: code=<lua_code>
function luaexec(ctx, desync)
if not desync.arg.code then
error("luaexec: no 'code' parameter")
end
local fname = desync.func_instance.."_luaexec_code"
if not _G[fname] then
_G[fname] = load(desync.arg.code, fname)
end
-- allow dynamic code to access desync
_G.desync = desync
_G[fname]()
_G.desync = nil
end
-- dummy test function. does nothing.
-- no args
function pass(ctx, desync)
DLOG("pass")
end
-- prints desync to DLOG
function pktdebug(ctx, desync)
DLOG("desync:")
var_debug(desync)
end
-- drop packet
-- standard args : direction, payload
function drop(ctx, desync)