Hi
I’m getting the error “Attempt to index global ‘nextQ’ (a nil value)” from the following code and I’m not sure why. I cant seem to reference anything inside that function. All I need is for the button to be removed once pressed. Its not a local variable so I assumed it should work. Any ideas?
local function nextButton() nextQ:removeSelf() nextQ = nil --destroyAll() --getNewQuiz() end nextQ = widget.newButton( { parent = sceneGroup, label = "Next -\>", onEvent = nextButton, emboss = false, -- Properties for a rounded rectangle button shape = "roundedRect", width = 100, height = 50, cornerRadius = 2, fillColor = { default={1,1,1,1}, over={1,0.1,0.3,0.4} }, strokeColor = { default={0.1,0.3,0,1}, over={0.9,0.8,1,1} }, strokeWidth = 10 } ) nextQ.x = centerX +250 nextQ.y = centerY + 45 end
