Lua Global Variables

Main.LuaGlobalVariables History

Hide minor edits - Show changes to markup

December 26, 2008, at 04:02 PM EST by admin
Changed line 27 from:

The next step is to learn about the exposed MUD Object Properties.

to:

The next step is to learn about the exposed Lua MUD Object Properties.

December 26, 2008, at 04:01 PM EST by admin
Changed line 27 from:

The next step is to learn about the

to:

The next step is to learn about the exposed MUD Object Properties.

December 26, 2008, at 04:00 PM EST by admin
Added lines 1-27:

The following Lua objects are always defined wherever their use is appropriate:

self (type ch): The mob the program is currently running on. For example, if a guard triggers a program from a 'greet' trigger, 'self' will always refer to that guard. On a program attached to a mob, 'self' will always be defined. This may not be true on programs attached to rooms and objects.

ch: (type ch): When a program is triggered by another character, 'ch' will be the character that triggered the prog. On a greet trigger it will be the character that entered the room. If an object has a wield trigger, it will be the character that wielded the item. On random/timed progs that fire without needing a character to trigger them, 'ch' may not be defined.

obj (type obj): Type (OBJ) : If a prog is attached to an object, or is a character trigger that involves an item (a give trigger for example), obj will always be the object that triggered the program.

room (type room): If a program is attached to a room, room will always be the room the program is running on.

mud (type mud) MUD refers to the game itself and is used to access global mud properties such as the time of day, the current season, number online, etc.

It is important to know these variables and the properties they expose (below) as 99% of the time these are the only variables you will need to work with. Some MUD functions will return new variables of type CH, ROOM or OBJ and all properties available to the global variables will be available to these new values. For example, when you call the mud function to return a random character from the room, you will receive back a variable of type (CH).

The next step is to learn about the