Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("h2touchpanel")
- -- button_config: "name"(string) and "cmd"(function) are required.
- local bCfg = {}
- bCfg[1]={name="final phase", cmd=function() rs.setOutput("back", true) end}
- bCfg[2]={name="close", cmd=function() rs.setOutput("bottom", false) end}
- bCfg[3]={name="pass", cmd=myNewFunc}
- bCfg[4]={name="sleep", cmd=runProgram}
- -- define function
- local myNewFunc = function() print("hello") end
- local runProgram = function() sleep(10) shell.run("hevo2.lua") end
- local mon = term
- --local mon = peripheral.wrap("top")
- -- makePanel(button_cfg, col, row, mon) returns Panel-object.
- local p1 = h2touchpanel.makePanel(bCfg, 2, 2, mon)
- p1:draw()
- while true do
- local event, b1 = p1:pullButtonPushEvent() -- returns pushed Button-object
- p1:drawPushedButtonEffect(b1) -- pushed effect
- b1:evalCmd() -- eval(run) function
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement