These are all global static methods within Lua.
Static variables
Static methods
staticcollectgarbage(opt:CollectGarbageOption, ?arg:Int):Int
This function is a generic interface to the garbage collector. It performs different functions according to its first argument.
staticerror(message:String, ?level:Int):Void
Generates a Lua error. The error message (which can actually be a Lua value of any type) must be on the stack top. This function does a long jump, and therefore never returns.
staticgetmetatable(tbl:Table<Dynamic, Dynamic>):Table<Dynamic, Dynamic>
Pushes onto the stack the metatable in the registry.
staticloadfile(filename:String):LoadResult
Loads the chunk from file filename or from the standard input if no filename is given.
staticnext<K, V>(k:Table<K, V>, ?i:K):NextResult<K, V>
Allows a program to traverse all fields of a table.
Its first argument is a table and its second argument is an index in this
table. next
returns the next index of the table and its associated value.
When i
is null
, next
returns an initial index and its associated value.
When called with the last index, or with null
in an empty table, next
returns null
. In particular, you can use next(t)
to check whether a
table is empty.
The order in which the indices are enumerated is not specified, even for
numeric indices. (To traverse a table in numeric order, use a numerical for
or the ipairs
function).
The behavior of next is undefined if, during the traversal, any value to a non-existent field in the table is assigned. Existing fields may however be modified. In particular, existing fields may be cleared.
staticprint(v:Rest<Dynamic>):Void
Receives any number of arguments, and prints their values to stdout,
using the tostring function to convert them to strings.
print
is not intended for formatted output, but only as a quick way to show
a value, typically for debugging.
For complete control of how numbers are converted, use NativeStringTools.format
.
staticrawget<K, V>(t:Table<K, V>, k:K):V
Gets the real value of table[index]
, without invoking any metamethod.
staticrawset<K, V>(t:Table<K, V>, k:K, v:V):Void
Sets the real value of table[index]
to value, without invoking any metamethod.
staticselect(n:Dynamic, rest:Rest<Dynamic>):Dynamic
If n
is a number, returns all arguments after argument number n
.
Otherwise, n
must be the string "#"
, and select returns the total
number of extra arguments it received.
staticsetfenv(i:Int, tbl:Table<Dynamic, Dynamic>):Void
Pops a table from the stack and sets it as the new environment for the value
at the given index. If the value at the given index is neither a function nor
a thread nor a userdata, lua_setfenv returns 0
.
Otherwise it returns 1
.
staticsetmetatable(tbl:Table<Dynamic, Dynamic>, mtbl:Table<Dynamic, Dynamic>):Table<Dynamic, Dynamic>
Pops a table from the stack and sets it as the new metatable for the value at the given acceptable index.
statictonumber(str:String, ?base:Int):Int
Converts the Lua value at the given acceptable base to Int
.
The Lua value must be a number or a string convertible to a number,
otherwise tonumber
returns 0
.
statictostring(v:Dynamic):String
Receives an argument of any type and converts it to a string in a reasonable format.
For complete control of how numbers are converted, useNativeStringTools.format
.