User:WhiteWizard/Lua API
From Tapestries MUCK
(Difference between revisions)
WhiteWizard (Talk | contribs) (Created page with "This is a very quick definition of the (desired) API to access the Muck from Lua. ==Database== Almost all database access is done through a lua class. In the examples, '''d''' r...") |
WhiteWizard (Talk | contribs) (→Database) |
||
Line 8: | Line 8: | ||
* string d:name() - Return the name of the object. | * string d:name() - Return the name of the object. | ||
* nil d:set_name(name, [password]) - Set the name. Password required for a player. | * nil d:set_name(name, [password]) - Set the name. Password required for a player. | ||
+ | * string d:unparse() - Returns the name in the long format that includes the dbref and flags. | ||
* integer d:type() - Returns the type of the object. One of: dbref.THING, dbref.PLAYER, dbref.GARBAGE, dbref.EXIT, dbref.ROOM | * integer d:type() - Returns the type of the object. One of: dbref.THING, dbref.PLAYER, dbref.GARBAGE, dbref.EXIT, dbref.ROOM | ||
* bool d.is_(thing|player|garbage|exit|room)() - Returns true if it is of this type. | * bool d.is_(thing|player|garbage|exit|room)() - Returns true if it is of this type. | ||
* bool d:is_valid() - Is > 0 < dbtop and not GARBAGE | * bool d:is_valid() - Is > 0 < dbtop and not GARBAGE | ||
- | * string d:(success | + | * string d:(success|osuccess|fail|ofail|drop|odrop)() - Get success/osuccess/fail/ofail/drop/odrop message. |
- | * nil d:set_(success | + | * nil d:set_(success|osuccess|fail|ofail|drop|odrop)(string) - Set success/osuccess/fail/ofail/drop/odrop message. |
+ | * string|int|dbref|nil d:get_prop(string name) - Returns the value of a property or nil. | ||
+ | * nil d:set_prop(string name, string|int|dbref) - Set a property. | ||
+ | * bool d:is_propdir(string name) - Is the given name a propdir? | ||
+ | * nil d:remove_prop(stirng name) - Delete property if it exists. | ||
+ | * string d:parse_prop(string name) - Parse a property with MPI and return a string. | ||
+ | * table d:get_properties(nil | string base) - Starting at base, or /, get all the properties as a table. | ||
+ | * string d:pronoun_sub(string source) - Only makes sense on a player object | ||
+ | |||
+ | === Misc === |
Revision as of 23:22, 22 May 2013
This is a very quick definition of the (desired) API to access the Muck from Lua.
Database
Almost all database access is done through a lua class. In the examples, d refers to a dbref class instance.
- string d:desc() - Return the description of the object.
- nil d:set_desc(desc) - Set above.
- string d:name() - Return the name of the object.
- nil d:set_name(name, [password]) - Set the name. Password required for a player.
- string d:unparse() - Returns the name in the long format that includes the dbref and flags.
- integer d:type() - Returns the type of the object. One of: dbref.THING, dbref.PLAYER, dbref.GARBAGE, dbref.EXIT, dbref.ROOM
- bool d.is_(thing|player|garbage|exit|room)() - Returns true if it is of this type.
- bool d:is_valid() - Is > 0 < dbtop and not GARBAGE
- string d:(success|osuccess|fail|ofail|drop|odrop)() - Get success/osuccess/fail/ofail/drop/odrop message.
- nil d:set_(success|osuccess|fail|ofail|drop|odrop)(string) - Set success/osuccess/fail/ofail/drop/odrop message.
- string|int|dbref|nil d:get_prop(string name) - Returns the value of a property or nil.
- nil d:set_prop(string name, string|int|dbref) - Set a property.
- bool d:is_propdir(string name) - Is the given name a propdir?
- nil d:remove_prop(stirng name) - Delete property if it exists.
- string d:parse_prop(string name) - Parse a property with MPI and return a string.
- table d:get_properties(nil | string base) - Starting at base, or /, get all the properties as a table.
- string d:pronoun_sub(string source) - Only makes sense on a player object