找不到lua_open lua_openlib

来源:互联网 发布:中信高端手机炒股软件 编辑:程序博客网 时间:2024/06/07 19:26

http://blog.csdn.net/x356982611/article/details/47405351


 使用lua5.2发现编译器找不到lua_open函数,最后发现这个函数在5.2中已经被遗弃,被新的函数luaL_newstate和lua_newstate替代。lua_newstate可自定义内存分配函数,luaL_newstate使用默认的内存分配方式。


下面是5.2中头文件部分定义


[cpp] view plain copy
  1. /* compatibility with old module system */  
  2. #if defined(LUA_COMPAT_MODULE)  
  3.   
  4. LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname,  
  5.                                    int sizehint);  
  6. LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname,  
  7.                                 const luaL_Reg *l, int nup);  
  8.   
  9. #define luaL_register(L,n,l)    (luaL_openlib(L,(n),(l),0))  
  10.   
  11. #endif  

0 0