Client
Last updated on
The elevators contract on the client — the nearest lift, local floor hints, ride requests and the floor list.
local elevators = OPX.Api.Get('elevators')From client code inside opx_infinity. Results are { ok, value } / { ok = false, error }; a refusal also carries elevator, floor and reason (the floor's REASON) when known. elevatorKey may be nil to mean the nearest elevator.
NearestElevator
The nearest configured lift within USE_RADIUS across the ground, from a recent scan.
elevators.NearestElevator()Returns
Result{ elevator, id }— errorno_elevator_nearby
Floors
Same rows as the server's Floors, from the client's own job snapshot.
elevators.Floors(elevatorKey)Parameters
- elevatorKey?:
string
Returns
Result{ elevator, floors }
IsFloorAllowed
A local hint. The server decides.
elevators.IsFloorAllowed(elevatorKey, floorIndex)Parameters
- elevatorKey?:
string - floorIndex:
integer
Returns
Result{ elevator, floor, label }
RequestFloor
Sends a ride request. "Ok" means sent; the server's verdict arrives on opx:on:elevators:decision.
elevators.RequestFloor(elevatorKey, floorIndex, origin)Parameters
- elevatorKey?:
string - floorIndex:
integer - origin?:
string— echoed assource.
Returns
Result{ elevator, floor, label, queued = true, source }
elevators.RequestFloor(nil, 2, 'mymodule')OpenPanel
Opens the floor list in a menu (owner elevators); what the KEY calls. A refused floor from the list shows a toast.
elevators.OpenPanel(elevatorKey)Parameters
- elevatorKey?:
string
Returns
Result{ elevator, floors, queued = true }— errors includeplayer_down,menu_not_running,no_floors_available, and any menu code
State
This client's view: job snapshot, lifts in range, lifts bound by the server.
elevators.State()Returns
Result{ job, grade, onDuty, fresh, ageMs, seen, bound, nearest }