Some ideas to embedding lua into C/C++

来源:互联网 发布:会计使用的软件 编辑:程序博客网 时间:2024/04/30 06:44

1. Two different way

     lua_open can create a new lua_State. Every lua_State has its own execute environment. So, we can create more than one lua_State.

     Way 1: Create a lua_State, load all lua script in it. Call functions in the lua_State, they share same global variables.

     Way 2: Create a lua_State for every lua script. Every lua script work in its own lua_State.

 

 

2.  Lua standard library

     "luaL_openlibs" open all standard libraries. It's not necessarily, you can ignore it to reduce memory size.