pub unsafe extern "C" fn lua_load(
l: *mut lua_State,
reader: lua_Reader,
dt: *mut c_void,
chunkname: *const c_char,
) -> c_int
Expand description
[-0, +1, -]
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. The return values of lua_load
are:
0
: no errors;LUA_ERRSYNTAX
: syntax error during pre-compilation;LUA_ERRMEM
: memory allocation error. 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 program luac
).
The lua_load
function uses a user-supplied reader
function to read
the chunk (see lua_Reader
). 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