User:WhiteWizard/Lua API
From Tapestries MUCK
(Difference between revisions)
WhiteWizard (Talk | contribs) (→Misc) |
WhiteWizard (Talk | contribs) (→Database) |
||
Line 14: | Line 14: | ||
* string d:(success|osuccess|fail|ofail|drop|odrop)() - Get success/osuccess/fail/ofail/drop/odrop message. | * 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. | * 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. | + | * string|int|dbref|lock|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. | * nil d:set_prop(string name, string|int|dbref) - Set a property. | ||
* bool d:is_propdir(string name) - Is the given name a propdir? | * bool d:is_propdir(string name) - Is the given name a propdir? | ||
Line 21: | Line 21: | ||
* table d:get_properties(nil | string base) - Starting at base, or /, get all the properties as a table. | * 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 | * string d:pronoun_sub(string source) - Only makes sense on a player object | ||
+ | * nil d:set_flag(string flags) | ||
+ | * string d:flags() | ||
+ | * bool d:flag(string flag) | ||
+ | * int d:get_mlevel() | ||
+ | * int d:pennies() | ||
+ | * nil d:set_pennies(int value) - Absolute, not relative. | ||
+ | * nil d:add_pennies(int value) - Relative, negitive removes. | ||
+ | * nil d:force(string command) - @force a player. | ||
+ | * table d:timestamps() - keys: created, last_modified, last_used, use_count | ||
+ | * table d:stats() - Only works on players. Returns a table of # of objects owned by various types and total. | ||
+ | * dbref d:link() what this is linked to. | ||
+ | * nil d:set_link(dbref dest) link an object. | ||
+ | * nil d:unlink() - Unlink an object | ||
+ | * dbref d:owner() | ||
+ | * nil d:set_owner(dbref player) | ||
+ | * nil d:recycle() | ||
+ | * bool d:check_password(string password) | ||
+ | * nil d:move(dbref destination) | ||
+ | * dbref d:location() | ||
+ | * array d:contents() | ||
+ | * array d:exits() | ||
+ | |||
+ | |||
+ | ===Locks=== | ||
+ | * bool d:is_locked(dbref player) | ||
+ | * string d:lock_string() | ||
+ | * nil d:set_lock_string() | ||
+ | * lock d:parse_lock(string lock_expression) | ||
+ | * nil d:clear_lock() | ||
+ | |||
+ | * bool lock:test(dbref player) | ||
+ | * string lock:unparse() | ||
+ | * string lock:pretty() | ||
+ | * array d:connections() | ||
+ | * bool d:is_awake() | ||
+ | * int d:idle_time() - Lowest idle time from all connections. | ||
+ | * int d:con_time() | ||
+ | * array d:owns() | ||
+ | |||
+ | ==Globals== | ||
+ | * caller | ||
+ | * me | ||
+ | * trigger | ||
+ | * program | ||
+ | |||
+ | ==Connection== | ||
+ | c = a connection object | ||
+ | * array connection.connections() | ||
+ | * dbref c:player() | ||
+ | * int c:idle() | ||
+ | * nil c:boot() | ||
+ | * int c:con_time() | ||
== Misc == | == Misc == |
Revision as of 23:48, 22 May 2013
This is a very quick definition of the (desired) API to access the Muck from Lua.
Contents |
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|lock|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
- nil d:set_flag(string flags)
- string d:flags()
- bool d:flag(string flag)
- int d:get_mlevel()
- int d:pennies()
- nil d:set_pennies(int value) - Absolute, not relative.
- nil d:add_pennies(int value) - Relative, negitive removes.
- nil d:force(string command) - @force a player.
- table d:timestamps() - keys: created, last_modified, last_used, use_count
- table d:stats() - Only works on players. Returns a table of # of objects owned by various types and total.
- dbref d:link() what this is linked to.
- nil d:set_link(dbref dest) link an object.
- nil d:unlink() - Unlink an object
- dbref d:owner()
- nil d:set_owner(dbref player)
- nil d:recycle()
- bool d:check_password(string password)
- nil d:move(dbref destination)
- dbref d:location()
- array d:contents()
- array d:exits()
Locks
- bool d:is_locked(dbref player)
- string d:lock_string()
- nil d:set_lock_string()
- lock d:parse_lock(string lock_expression)
- nil d:clear_lock()
- bool lock:test(dbref player)
- string lock:unparse()
- string lock:pretty()
- array d:connections()
- bool d:is_awake()
- int d:idle_time() - Lowest idle time from all connections.
- int d:con_time()
- array d:owns()
Globals
- caller
- me
- trigger
- program
Connection
c = a connection object
- array connection.connections()
- dbref c:player()
- int c:idle()
- nil c:boot()
- int c:con_time()