小编Sla*_*avi的帖子

最新版本中的Loadstring函数替换

我从lua 5.1更新到5.3.2,我的一个脚本没有工作attempt to call a nil value (global 'loadstring')因此,是否用新功能替换它?

在那里你可以找到函数https://www.lua.org/pil/8.html
在那里你可以测试它(不会工作)http://www.lua.org/cgi-bin/demo

lua

13
推荐指数
1
解决办法
5916
查看次数

Lua 从参数中获取函数

一个简单的生产例子。

protocol.onConnect(function() end, function () end, ...)
Run Code Online (Sandbox Code Playgroud)

现在在 c 中,我想获取 args #1、#2 中的函数。
在字符串,数字,...我们可以使用 (lua_getstring,..) 来获取它们,但我至少没有找到如何获取函数。

int luaProtocolOnConnect(lua_State* L)
{
    int base_func // func #1
    int call_func // func #2
    ....
}
Run Code Online (Sandbox Code Playgroud)

c++ lua

4
推荐指数
2
解决办法
1120
查看次数

在表上的同一调用中设置2个键的值

我在寻找的是这样的代码.

local sometable = {
    [1] = [2] = "abc",
}
Run Code Online (Sandbox Code Playgroud)

所以这肯定是设置2个键的错误方法.(返回错误)

lua

3
推荐指数
1
解决办法
516
查看次数

标签 统计

lua ×3

c++ ×1