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?!?!?")
return
en