Difference between revisions of "Os.queueEvent"
From ComputerCraft Wiki
m (Updated references from "os" to "OS") |
|||
| (5 intermediate revisions by 3 users not shown) | |||
| Line 3: | Line 3: | ||
|name=os.queueEvent | |name=os.queueEvent | ||
|args=[[string]] eventName, param1, param2, param3 | |args=[[string]] eventName, param1, param2, param3 | ||
| − | |api= | + | |api=OS |
|addon=ComputerCraft | |addon=ComputerCraft | ||
|desc=Adds an event <var>eventName</var> with the specified parameters to the event queue. | |desc=Adds an event <var>eventName</var> with the specified parameters to the event queue. | ||
| Line 10: | Line 10: | ||
|desc=The program adds an event which it will eventually pull. | |desc=The program adds an event which it will eventually pull. | ||
|code= | |code= | ||
| − | os.queueEvent("abc", 2, "meow") | + | os.queueEvent("abc", 2, "meow") |
| − | + | while true do | |
| − | + | local event, param1, param2 = os.pullEvent() | |
| − | + | if event == "abc" then | |
| − | + | print("ABC EVENT! Parameters: " .. param1 .. " / " .. param2) | |
| − | + | else | |
| − | + | print("Event: " .. event) | |
| − | + | end | |
| − | end | + | end |
}} | }} | ||
}} | }} | ||
| Line 28: | Line 28: | ||
local event, param1 = os.pullEvent() | local event, param1 = os.pullEvent() | ||
if event == "redstone" then | if event == "redstone" then | ||
| − | + | if rs.getInput("left") then | |
| − | + | os.queueEvent("key", 28) | |
| − | + | end | |
elseif event == "key" then | elseif event == "key" then | ||
| − | + | if param1 == 28 then | |
| − | + | print("Hello") | |
| − | + | end | |
end | end | ||
end | end | ||
}} | }} | ||
| + | |||
| + | [[Category:Lua_Core_Functions]] | ||
Latest revision as of 14:09, 30 November 2012
| Adds an event eventName with the specified parameters to the event queue. | |
| Syntax | os.queueEvent(string eventName, param1, param2, param3) |
| Returns | nil |
| Part of | ComputerCraft |
| API | OS |
Examples