Advertisement
Guest User

nebula-test.lua

a guest
Jan 20th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. local nebula = require('nebula')
  2. local nebulaApp = nebula.createApplication("default", nil, colors.white)
  3. local neatlabel
  4. local button1
  5.  
  6. local function setLabel() end
  7.  
  8. local button1 = nebulaApp.addChild("button", 2, 4, "", function()
  9.   if neatlabel then
  10.     neatLabel = nil
  11.   else
  12.     neatlabel = nebulaApp.addChild("label", 2, 6, "cheese smelly")
  13.   end
  14.   setLabel()
  15. end)
  16.  
  17. setLabel = function()
  18.   if not neatLabel then
  19.     button1.text = "Make a label"
  20.   else
  21.     button1.text = "Destroy label"
  22.   end
  23. end
  24.  
  25. local label1 = nebulaApp.addChild("label", 2, 2, "Hello world")
  26.  
  27.  
  28. setLabel()
  29. nebula.draw()
  30.  
  31. nebula.init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement