lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Alexey Tourbin wrote:
> What is wrong with the following code?
> 
> #include <lua.h>
> #include <lualib.h>
> #include <lauxlib.h>
> int main()
> {
>         lua_State *L = lua_open();
>         luaopen_base(L);
>         luaopen_table(L);
>         luaopen_io(L);
>         luaopen_string(L);
>         luaopen_math(L);
>         return 0;
> }
> 
> [...]
> 
> lua-5.1.2

Manual, section 7.3:

http://www.lua.org/manual/5.1/manual.html#7.3

"The luaopen_* functions (to open libraries) cannot be called directly,
like a regular C function. They must be called through Lua, like a Lua
function."