Lua MUD Object Properties
Accessing Object Properties
Using 'ch' as an example which represents a character object in the MUD, accessing properties is as simple as using 'ch.level', 'ch.gold', 'ch.int', etc.
Example code may be:
if ch.level > 100 then send(ch,"You are a noble!") end
if ch.int < self.int --- remember, self is the mob running the prog. say("I'm smarter than you!") else say("You're smarter than me!") end
If you are dealing with an object, you may write something like
if obj.level < 100 then say ("I don't accept this low level junk!") mdo ("give " .. obj.name .. " " .. ch.name) end
The line beginning 'mdo' is using Lua concatentation to create a command the character will execute in the MUD itself - in this case returning the object to the character that triggered the script.