Lua动态加载脚本( loadstring )

作者:糖果

下面是代码:

local lua_script = [[
     local var = 1
     print(var)
]]


local  script = lua_script 
local tb=assert(loadstring(script))()
print(tb[0].text)
const char* testfunc = "print (add(1.0, 2.0)) print(sub(20.1, 19))";

int main()
{
        lua_State* L = luaL_newstate();
        luaL_openlibs(L);
        lua_register(L, "add", add);
        lua_register(L, "sub", sub);

        if (luaL_dostring(L, testfunc))
                printf("Failed to invoke.\n");

        lua_close(L);
        return 0;
}

糖果实验室 www.lua.ren/topic/158

糖果

糖果
LUA从入门到放弃

Moonscript如何显示复选框

Moonscript如何显示复选框 Continue reading

Lapis框架的常用处理方法

Published on March 02, 2017