lua-users home
lua-l archive

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


> What's the table? Docs mention nothing about a table on the stack after
> calling these.

Which docs? As far as I know, there are no docs about them :)

All functions that open libraries are C functions (lua_CFunction).
(Actually, with loadlib, they may be real C functions in Lua.)  As
such, they follow the protocol for C functions. That protocol says that
the function may leave garbage and results on the stack. If you check
openstdlibs (in lua.c), the code that opens the libs, you will see this:

    for (; lib->func; lib++) {
      lib->func(l);  /* open library */
      lua_settop(l, 0);  /* discard any results */   <<<<<<<<<
    }

-- Roberto