LUA_LOAD(3) | Library Functions Manual | LUA_LOAD(3) |
lua_load
— loads a
Lua chunk, function indicator [-0, +1, -]
#include
<lua.h>
int
lua_load
(lua_State
*L, lua_Reader
reader, void *data,
const char
*chunkname);
lua_load
()
loads a Lua chunk. If there are no errors,
lua_load
() pushes the compiled chunk as a Lua
function on top of the stack. Otherwise, it pushes an error message.
This function only loads a chunk; it does not run it.
lua_load
()
automatically detects whether the chunk is text or binary, and loads it
accordingly, see luac(1).
The
lua_load
()
function uses a user-supplied reader function to read the chunk, see
lua_Reader(3). The data argument is an opaque value passed
to the reader function.
The chunkname argument gives a name to the chunk, which is used for error messages and in debug information.
The return values of lua_load
() are:
0
:LUA_ERRSYNTAX
:LUA_ERRMEM
:Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes, Lua 5.1 Reference Manual.
The lua_load
() manual page is based on Lua
Reference Manual 5.1 and was created by Sergey Bronnikov.
July 15, 2022 | Debian |