Module furniture
Functions for handling furniture.
Global functions
Furniture.create (shortdesc, longdesc, fulldesc) | create a new piece of furniture. |
Furniture.getFromID (id) | finds a furniture by ID |
Class Furniture
furniture:delete () | deletes the furniture outright |
furniture:fromRoom (Room) | removes this furniture from a room |
furniture:fromRooms () | removes this furniture from all rooms |
furniture:getComfort () | gets the comfort value of this furniture. |
furniture:getFullDescription () | gets the full description of this furniture. |
furniture:getId () | gets the ID of this furniture. |
furniture:getInRoom () | gets the first room this furniture is in, or nil if not in any room. |
furniture:getLongDescription () | gets the long description of this furniture. |
furniture:getShortDescription () | gets the short description of this furniture. |
furniture:hasPosition (position) | gets whether a given position is enabled on this furniture. |
furniture:rooms () | get an iterator over ships in the starsystem |
furniture:setComfort (the) | sets the comfort value of this furniture. |
furniture:setFullDescription (the) | sets the full description of this furniture. |
furniture:setLongDescription (the) | sets the long description of this furniture. |
furniture:setPosition (position, boolean) | sets whether a position is enabled on this furniture. |
furniture:setShortDescription (the) | sets the short description of this furniture. |
furniture:toRoom (Room) | adds this furniture to a room |
Global functions
- Furniture.create (shortdesc, longdesc, fulldesc)
-
create a new piece of furniture.
Parameters:
- shortdesc string the short description (required)
- longdesc string the long description (optional)
- fulldesc string the full description (optional)
Returns:
-
Furniture
the new furniture object.
- Furniture.getFromID (id)
-
finds a furniture by ID
Parameters:
- id number the furniture ID
Returns:
-
Furniture
the furniture, or nil if not found
Class Furniture
Functions on furniture variables
- furniture:delete ()
- deletes the furniture outright
- furniture:fromRoom (Room)
-
removes this furniture from a room
Parameters:
- Room room the room (or vnum) to remove the furniture from
Returns:
-
Furniture
this furniture, for call chaining.
- furniture:fromRooms ()
-
removes this furniture from all rooms
Returns:
-
Furniture
this furniture, for call chaining.
- furniture:getComfort ()
-
gets the comfort value of this furniture.
Returns:
-
number
the furniture's current comfort value.
- furniture:getFullDescription ()
-
gets the full description of this furniture.
Can return nil if it's not set, in which case the full description is used in the room.
Returns:
-
string
the furniture's current full description, or nil if unset.
- furniture:getId ()
-
gets the ID of this furniture.
Returns:
-
number
the ID of this furniture.
- furniture:getInRoom ()
-
gets the first room this furniture is in, or nil if not in any room.
Returns:
-
Room
the first room where the furniture is located, or nil if not in any room.
- furniture:getLongDescription ()
-
gets the long description of this furniture.
Can return nil if it's not set, in which case the short description is used in the room.
Returns:
-
string
the furniture's current long description, or nil if unset.
- furniture:getShortDescription ()
-
gets the short description of this furniture.
Returns:
-
string
the furniture's current short description.
- furniture:hasPosition (position)
-
gets whether a given position is enabled on this furniture.
Parameters:
- position string (sitat, sit, rest, or lie)
Returns:
-
boolean
true whether the given position is enabled on this furniture.
- furniture:rooms ()
-
get an iterator over ships in the starsystem
Returns:
-
an iterator of Room
Usage:
for room in furniture:rooms() do -- do something end
- furniture:setComfort (the)
-
sets the comfort value of this furniture.
Parameters:
- the number new comfort value for the furniture (currently does nothing).
Returns:
-
Furniture
this furniture, for call chaining.
- furniture:setFullDescription (the)
-
sets the full description of this furniture.
Parameters:
- the string new full description of the furniture. Can pass empty string to clear it.
Returns:
-
Furniture
this furniture, for call chaining.
- furniture:setLongDescription (the)
-
sets the long description of this furniture.
Parameters:
- the string new long description of the furniture. Can pass empty string to clear it.
Returns:
-
Furniture
this furniture, for call chaining.
- furniture:setPosition (position, boolean)
-
sets whether a position is enabled on this furniture.
Parameters:
- position string (sitat, sit, rest, or lie)
- boolean enabled whether the position should be enabled or disabled
Returns:
-
Furniture
this furniture, for call chaining.
- furniture:setShortDescription (the)
-
sets the short description of this furniture.
Parameters:
- the string new short description of the furniture.
Returns:
-
Furniture
this furniture, for call chaining.
- furniture:toRoom (Room)
-
adds this furniture to a room
Parameters:
- Room room the room (or vnum) to add the furniture to.
Returns:
-
Furniture
this furniture, for call chaining.