Globals

From Wherigo Foundation Wiki
Revision as of 13:25, 22 April 2018 by Ranger Fox (Talk | contribs) (Created page with "There are several basic Lua functions and objects available, as well as some objects defined by the Wherigo framework. These can be examined by accessing the results of the ge...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

There are several basic Lua functions and objects available, as well as some objects defined by the Wherigo framework. These can be examined by accessing the results of the getfenv() method. (Note: The following values were acquired using the Wherigo Builder PPC Emulator. Support for particular objects and methods, and returned values, may differ on other platforms.) Additional details about many of the standard Lua functions can be found in the Lua 5.1 Reference Manual.


Properties

_VERSION The version of the Lua interpreter being used. Currently reports "Lua 5.1".
cartridge Instance of the Wherigo.ZCartridge class containing information about the cartridge currently being played.
Player Instance of the Wherigo.ZCharacter class containing information representing the user of the cartridge.


Tables

_G Reference to the global scope of interpreter; refers to the same object this page describes. (_G == _G._G)
buildervar Generated by the Wherigo Builder and used to track user variables defined within the Builder application.
coroutine Standard Lua library of coroutine handling methods.
debug Standard Lua library of debugging methods.
Env Contains some general environment variables, including information on the platform.
io Standard Lua library of input/output methods.
math Standard Lua library of mathematical methods.
os Standard Lua library of operating system methods, notably time/date access.
package Standard Lua library of package access methods. Unlikely to be of much use in the Wherigo environment.
string Standard Lua library of string manipulation and comparison methods.
table Standard Lua library of table manipulation methods.
Wherigo Contains classes, objects, properties, and many other goodies that are part of the Wherigo framework.
WIGInternal Contains additional Wherigo methods; based on name, use of these functions in user code is likely a bad idea (but is equally likely to be a lot of fun). The functions are used to communicate with the engine and are platform specific.


Extensions of libraries

string.Trim(string str) Returns string. Removes all leading and trailing whitespace characters from string.
string.Equals(string str1, string str2) Returns boolean. Checks, if lower str1 and lower str2 are equal.
table.Contains(table t, luatype element) Returns boolean and luatype. Checks, if the luatype element exists in the table t. If yes, the it returns true and the index, otherwise false.
table.Add(table t, luatype element) Inserts luatype element into table t.
table.Remove(table t, luatype element) Returns boolean. Removes luatype element from table t, if it is in the table and returns true, if it is removed.


Methods

_print Unknown.
assert Standard Lua function. See Lua documentation for details.
collectgarbage Standard Lua function. See Lua documentation for details.
error Standard Lua function. See Lua documentation for details.
dofile Standard Lua function. See Lua documentation for details.
getfenv Standard Lua function. See Lua documentation for details.
getmetatable Standard Lua function. See Lua documentation for details.
gcinfo Standard Lua function. See Lua documentation for details.
ipairs Standard Lua function. See Lua documentation for details.
load Standard Lua function. See Lua documentation for details.
loadfile Standard Lua function. See Lua documentation for details.
loadstring Standard Lua function. See Lua documentation for details.
module Standard Lua function. See Lua documentation for details.
newproxy Standard Lua function. See Lua documentation for details.
next Standard Lua function. See Lua documentation for details.
pairs Standard Lua function. See Lua documentation for details.
pcall Standard Lua function. See Lua documentation for details.
print Standard Lua function. See Lua documentation for details.
rawequal Standard Lua function. See Lua documentation for details.
rawget Standard Lua function. See Lua documentation for details.
rawset Standard Lua function. See Lua documentation for details.
require Standard Lua function. See Lua documentation for details.
select Standard Lua function. See Lua documentation for details.
setfenv Standard Lua function. See Lua documentation for details.
setmetatable Standard Lua function. See Lua documentation for details.
tonumber Standard Lua function. See Lua documentation for details.
tostring Standard Lua function. See Lua documentation for details.
type Standard Lua function. See Lua documentation for details.
unpack Standard Lua function. See Lua documentation for details.
xpcall Standard Lua function. See Lua documentation for details.