So I am pretty new to Lua, having only used it very lightly in the past for basic scripts. I am having some issue that hopefully someone can help me with and it can be best described as a "function losing scope". I'll post the code and explain it.
local buildWitherButton = app:addChild(GUI.roundedButton(buttonLeftAnchor,13, buttonWidth,7, buttonDefaultColor, bgColor, buttonPressedColor, bgColor,"BUILD WITHER"))
buildWitherButton.onTouch =function()if(powerButton.pressed ~=true)then
throwWitherBuildError("Can't build Wither with shield down, are you mad?!?!?")returnend-- Do wither stuff
note.play(80)
clearAndInitProgressBar()
e = event.timer(1, progressUpdate,10)-- MC states 10 seconds to build a Wither, so this rough timer will work for now. Call the function every 1 second, for 10 secondsend
buildProgressBar = app:addChild(GUI.progressBar(buttonLeftAnchor,20, buttonWidth, buttonPressedColor, fgColor, textDefaultColor,0,true,true,"Building Wither : ","%"))
buildProgressBar.hidden =truefunction clearAndInitProgressBar()
buildProgressBar.hidden =false
buildProgressBar.value =0endlocalfunction progressUpdate()
buildProgressBar.value = buildProgessBar.value +50-- This lines does literally nothing, I can type it wrong and everything, or even assign strings, booleans, tables. It's like the line is completely ignored
note.play(75)-- This beeps. wtf is happening above?end
I am using a GUI library, which can be found HERE. I completely lack the knowledge of the language and API to understand what is wrong, it's also impossible to Google :p.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
So I am pretty new to Lua, having only used it very lightly in the past for basic scripts. I am having some issue that hopefully someone can help me with and it can be best described as a "function losing scope". I'll post the code and explain it.
I am using a GUI library, which can be found HERE. I completely lack the knowledge of the language and API to understand what is wrong, it's also impossible to Google :p.
Any ideas?
Link to post
Share on other sites