Game Development Reference
In-Depth Information
collect : Performs a full garbage-collection cycle. This is the default option.
stop : Stops the garbage collector.
restart : Restarts the garbage collector.
count : Returns the total memory in use by Lua.
step : Performs a garbage-collection step. The step size is governed by arg .
setpause : Sets arg as the new value for pause and returns the previous value of
pause .
setstepmul : Sets arg as the new value for the step multiplier and returns the
previous value for step .
Tip If you want to know the memory usage of your app and clear up the memory and objects, you can
force the garbagecollector to free up and reclaim the memory allocated and then print the amount
of memory used after a cleanup by using the print(collectgarbage("count")) command.
You saw in Chapter 1 that Lua executes the code in chunks. This function opens the named file and
executes its contents as a Lua chunk. When called with no arguments, it executes the contents from
the standard input ( stdin ). It returns all values returned by the chunk. stdin is not available on iOS
devices, and with CoronaSDK the function is sandboxed (i.e., disallowed).
dofile("somefile.lua")
error ( message [,level] )
This function terminates the last protected function and returns the message as the error message.
error("This operations is invalid")
_G
This is not exactly a function, but a global variable. Lua does not use this variable, but it holds all the
global variables and function.
getfenv ( [f] )
This function returns the current environment in use by the function. The function f can be a Lua
function or number.
 
Search WWH ::




Custom Search