步骤:函数转字符串=>发送到远端=>远端loadstring得到函数=>调用之
local custom_func = function ()
print("asdf")
end
local func_content = string.dump(custom_func) --将函数序列化为字符串
将字符串func_content发送到远端
local myfunc = loadstring(func_content) --将字符串转换为函数
myfunc()
步骤:函数转字符串=>发送到远端=>远端loadstring得到函数=>调用之
local custom_func = function ()
print("asdf")
end
local func_content = string.dump(custom_func) --将函数序列化为字符串
将字符串func_content发送到远端
local myfunc = loadstring(func_content) --将字符串转换为函数
myfunc()