wrap os.pullEventRaw to have return types
This commit is contained in:
@@ -37,6 +37,40 @@ types.TRI_FAIL = {
|
||||
|
||||
-- STRING TYPES --
|
||||
|
||||
---@alias os_event
|
||||
---| "alarm"
|
||||
---| "char"
|
||||
---| "computer_command"
|
||||
---| "disk"
|
||||
---| "disk_eject"
|
||||
---| "http_check"
|
||||
---| "http_failure"
|
||||
---| "http_success"
|
||||
---| "key"
|
||||
---| "key_up"
|
||||
---| "modem_message"
|
||||
---| "monitor_resize"
|
||||
---| "monitor_touch"
|
||||
---| "mouse_click"
|
||||
---| "mouse_drag"
|
||||
---| "mouse_scroll"
|
||||
---| "mouse_up"
|
||||
---| "paste"
|
||||
---| "peripheral"
|
||||
---| "peripheral_detach"
|
||||
---| "rednet_message"
|
||||
---| "redstone"
|
||||
---| "speaker_audio_empty"
|
||||
---| "task_complete"
|
||||
---| "term_resize"
|
||||
---| "terminate"
|
||||
---| "timer"
|
||||
---| "turtle_inventory"
|
||||
---| "websocket_closed"
|
||||
---| "websocket_failure"
|
||||
---| "websocket_message"
|
||||
---| "websocket_success"
|
||||
|
||||
---@alias rtu_t string
|
||||
types.rtu_t = {
|
||||
redstone = "redstone",
|
||||
|
||||
@@ -180,6 +180,16 @@ function util.time()
|
||||
return util.time_ms()
|
||||
end
|
||||
|
||||
-- OS --
|
||||
|
||||
-- OS pull event raw wrapper with types
|
||||
---@param target_event? string event to wait for
|
||||
---@return os_event event, any param1, any param2, any param3, any param4, any param5
|
||||
function util.pull_event(target_event)
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
return os.pullEventRaw(target_event)
|
||||
end
|
||||
|
||||
-- PARALLELIZATION --
|
||||
|
||||
-- protected sleep call so we still are in charge of catching termination
|
||||
|
||||
Reference in New Issue
Block a user