Module locker
Functions for lockers
Global functions
| Locker.all () | iterate over all lockers in the game (but only the ones loaded into memory) |
| Locker.create (room, Owner) | |
| Locker.getFromId (Id) |
Class Locker
| locker:close () | closes a locker |
| locker:contents () | iterates through a locker's contents |
| locker:delete () | deletes a locker (privileged programs only) |
| locker:getOwner () | get the owner of the locker (player or clan) |
| locker:getRoom () | get the room the locker is in |
| locker:open () | opens a locker |
| locker:setOwner (Owner) | sets the owner of the locker (player or clan) |
| locker:setRoom (room) | moves a locker to a new room (privileged programs only) |
Global functions
- Locker.all ()
-
iterate over all lockers in the game (but only the ones loaded into memory)
Returns:
-
an iterator of Locker
Usage:
for locker in Locker.all() do -- do something end
- Locker.create (room, Owner)
-
Parameters:
- room Room the locker-flagged room the locker will live in
- Owner the new owner of the lockerĀ (Character or Clan)
Returns:
-
The new locker, or nil if it couldn't be opened
Usage:
local clan = Clan.getFromName("The Galactic Empire") local locker = Locker.create(room, clan) if ( locker ~= nil ) then -- do something end
- Locker.getFromId (Id)
-
Parameters:
- Id The UID of the locker
Returns:
-
The locker, or nil if no match
Usage:
-- Get a locker from its UID local locker = Locker.getFromId(12345) if ( locker ~= nil ) then -- do something end
Class Locker
Functions on locker variables
- locker:close ()
-
closes a locker
Returns:
-
Locker
this locker, for call chaining.
Usage:
locker:close() - locker:contents ()
-
iterates through a locker's contents
Usage:
for obj in locker:contents() do obj:toChar(Nield) end
- locker:delete ()
-
deletes a locker (privileged programs only)
Usage:
locker:delete() - locker:getOwner ()
-
get the owner of the locker (player or clan)
Returns:
-
string
the locker's owner
Usage:
locker:getOwner() - locker:getRoom ()
-
get the room the locker is in
Returns:
-
Room
the room the locker is in
Usage:
locker:getRoom() - locker:open ()
-
opens a locker
Returns:
-
Locker
this locker, for call chaining.
Usage:
locker:open() - locker:setOwner (Owner)
-
sets the owner of the locker (player or clan)
Parameters:
- Owner the new owner of the lockerĀ (Character or Clan)
Usage:
local clan = Clan.getFromName("The Rebel Alliance") locker:setOwner(clan)
- locker:setRoom (room)
-
moves a locker to a new room (privileged programs only)
Parameters:
- room Room the new locker-flagged room the locker will live in
Returns:
-
Locker
this locker, for call chaining.
Usage:
local room = Room.getFromVNum(2) locker:setRoom(room)