parrotcode: Lua Auxiliary PIR Library | |
Contents | Language Implementations | Lua |
lib/luaaux.pir - Lua Auxiliary PIR Library
lua_argerror (narg, extramsg, ...)
func
is retrieved from the call stack: bad argument #<narg> to <func> (<extramsg>)
lua_checkany (narg, arg)
narg
.lua_checknumber (narg, arg)
narg
is a number and returns this number.lua_checkoption (narg, val, options)
lua_checkstring (narg, arg)
narg
is a string and returns this string.tostring
to get its result, so all conversions and caveats of that function apply here.lua_checktype (narg, arg, t)
narg
has type t
.lua_checkudata (narg, arg, tname)
narg
is a userdata of the type tname
.lua_error (message, ...)
lua_findtable (t, fname)
lua_gc (what, data)
what
:"size"
is controlled by data
(larger values mean more steps) in a non-specified way. If you want to control the step size you must tune experimentally the value of data
. Returns true if the step finished a garbage-collection cycle.data
/100 as the new value for the pause of the collector. The function returns the previous value of the pause.data
/100 as the new value for the step multiplier of the collector. The function returns the previous value of the step multiplier.lua_getfenv (o)
o
.lua_getmetatable (tname)
tname
.lua_gsub (src, pat, repl)
src
by replacing any occurrence of the string pat
with the string rep
.lua_isboolean (val)
lua_isfunction (val)
lua_isnil (val)
lua_isnumber (val)
lua_isstring (val)
lua_istable (val)
lua_isuserdata (val)
lua_load (data, name)
lua_load
automatically detects whether the chunk is text or binary, and loads it accordingly.chunkname
argument gives a name to the chunk, which is used for error messages and in debug information.lua_loadbuffer (buff, name)
name
is the chunk name, used for debug information and error messages.lua_loadfile (filename)
filename
is a empty string, then it loads from the standard input. The first line in the file is ignored if it starts with a #.lua_newmetatable (tname)
tname
, creates a new table to be used as a metatable for userdata, adds it to the registry with key tname
.tname
in the registry.lua_newuserdata (data, mt)
lua_openlibs ()
lua_optint (narg, arg, def)
narg
is a number, returns this number cast to an int
. If this argument is absent or is nil, returns def
. Otherwise, raises an error.lua_optstring (narg, arg, def)
narg
is a string, returns this string. If this argument is absent or is nil, returns def
. Otherwise, raises an error.lua_register (libname, lib, names, env)
lua_setfenv (o, table)
table
as the new environment for the value o
. If the value o
is neither a function nor a thread nor a userdata, returns 0. Otherwise it returns 1.lua_typerror (narg, got, expec)
bad argument narg to 'func' (tname expected, got rt)
argstolua (env, args)
checkforloop (start, limit, step)
docall (f, arg)
mkarg (argv)
not_implemented ()
tconstruct (table, index, argv)
Francois Perrad
|