builtin door - boyism80/fb GitHub Wiki

Built-in Functions Documentation (Door)

This document describes functions available to door type objects.


toggle

toggle()

  • Description:
    Toggles the door's open/closed state and returns the new opened state.
  • Parameters:
    • None
  • Return Value:
    • boolean: True if door is now opened, false if closed
  • Example:
    -- This is a real usage example from game scripts
    local opened = door:toggle()
    me:message("Door is now " .. (opened and "open" or "closed"))
    

lock

lock(value:boolean)

  • Description:
    Sets the lock state of the door and returns the new locked state.
  • Parameters:
    • value:boolean: True to lock the door, false to unlock
  • Return Value:
    • boolean: True if door is now locked, false if unlocked
  • Example:
    -- This is a real usage example from game scripts
    local is_locked = door:lock(true)
    me:message("Door is now " .. (is_locked and "locked" or "unlocked"))
    

locked

locked()

  • Description:
    Returns whether the door is currently locked.
  • Parameters:
    • None
  • Return Value:
    • boolean: True if door is locked, false otherwise
  • Example:
    -- This is a real usage example from game scripts
    if door:locked() then
        me:message("The door is locked")
    else
        me:message("The door is unlocked")
    end
    

opened

opened()

  • Description:
    Returns whether the door is currently opened.
  • Parameters:
    • None
  • Return Value:
    • boolean: True if door is opened, false otherwise
  • Example:
    -- This is a real usage example from game scripts
    if door:opened() then
        me:message("The door is open")
    else
        me:message("The door is closed")
    end