moved code for coherence

This commit is contained in:
2026-02-12 22:21:56 +01:00
parent 04ee42eaa7
commit 210c2d6231
12 changed files with 8 additions and 11 deletions

29
src/lua_func/tm.lua Normal file
View File

@@ -0,0 +1,29 @@
local tm = {}
local SUPPORTED_API = {
"gd",
"setgd",
"delgd",
}
-- underlying function
function tm._init_api(rpc)
tm._rpc = rpc
local function _api_request(fname, ...)
local args = {...}
return tm._rpc:call(fname, args)
end
for _, fname in ipairs(SUPPORTED_API) do
-- create a closure that calls common_handler with fname
tm[fname] = function(...)
return _api_request(fname, ...)
end
end
end
return tm