NAME ^

lib/luaaux.pir - Lua Auxiliary PIR Library

DESCRIPTION ^

Functions ^

lua_argerror (narg, extramsg, ...)

Raises an error with the following message, where func is retrieved from the call stack:

    bad argument #<narg> to <func> (<extramsg>)
This function never returns.

lua_checkany (narg, arg)

Checks whether the function has an argument of any type (including nil) at position narg.

lua_checknumber (narg, arg)

Checks whether the function argument narg is a number and returns this number.

lua_checkoption (narg, val, options)

lua_checkstring (narg, arg)

Checks whether the function argument narg is a string and returns this string.

This function uses tostring to get its result, so all conversions and caveats of that function apply here.

lua_checktype (narg, arg, t)

Checks whether the function argument narg has type t.

lua_checkudata (narg, arg, tname)

Checks whether the function argument narg is a userdata of the type tname.

lua_error (message, ...)

Raises an error.

This function never returns.

lua_findtable (t, fname)

lua_gc (what, data)

Controls the garbage collector.

This function performs several tasks, according to the value of the parameter what:

"stop"

stops the garbage collector.

"restart"

restarts the garbage collector.

"collect"

performs a full garbage-collection cycle.

"count"

returns the total memory in use by Lua (in Kbytes).

"step"

performs an incremental step of garbage collection The step "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.

"steppause"

sets data/100 as the new value for the pause of the collector. The function returns the previous value of the pause.

"setstepmul"

sets data/100 as the new value for the step multiplier of the collector. The function returns the previous value of the step multiplier.

STILL INCOMPLETE.

lua_getfenv (o)

Returns the environment table of the argument o.

lua_getmetatable (tname)

Returns the metatable registered with the name tname.

lua_gsub (src, pat, repl)

Returns a copy of string src by replacing any occurrence of the string pat with the string rep.

lua_loadbuffer (buff, name)

Loads a buffer as a Lua chunk.

name is the chunk name, used for debug information and error messages.

lua_loadfile (filename)

Loads a file as a Lua chunk. If 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 #.

This function only loads the chunk; it does not run it.

lua_newmetatable (tname)

Unless the registry already has the key tname, creates a new table to be used as a metatable for userdata, adds it to the registry with key tname.

In both cases returns the final value associated with tname in the registry.

lua_newuserdata (data, mt)

lua_openlibs ()

Opens all standard Lua libraries.

lua_optint (narg, arg, def)

If the function argument 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)

If the function argument 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)

lua_setfenv (o, table)

Sets the 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)

Generates an error with a message like the following:

    bad argument narg to 'func' (tname expected, got rt)
This function never returns.

Others functions ^

argstolua (env, args)

checkforloop (start, limit, step)

docall (f, arg)

mkarg (argv)

Support variable number of arguments function call.

not_implemented ()

tconstruct (table, index, argv)

end of table constructor with argv

AUTHORS ^

Francois Perrad


parrot