Hi, I am trying to add another switch, but when I save, this error occurs. When I remove the 2nd switch, there is no error. What is the problem?
local widget = require("widget") widget.setTheme ( "widget\_theme\_ios" ) display.setStatusBar(display.HiddenStatusBar) -- most commonly used screen coordinates centerX = display.contentCenterX centerY = display.contentCenterY screenLeft = display.screenOriginX screenWidth = display.contentWidth - screenLeft \* 2 screenRight = screenLeft + screenWidth screenTop = display.screenOriginY screenHeight = display.contentHeight - screenTop \* 2 screenBottom = screenTop + screenHeight display.contentWidth = screenWidth display.contentHeight = screenHeight -- pretty background local bg = display.newImage("images/sky.jpg") bg.x = centerX bg.y = centerY bg.width = screenWidth bg.height = screenHeight local function buttonPressed(event) local btn = event.target if btn.id == "options" then btn:setLabel("Foo!") end print("You pressed button:", btn.id) end local function doButtons() local optionsButton = widget.newButton { label="Set Options", id="options", onRelease=buttonPressed } optionsButton.x = centerX optionsButton.anchorY = 1 optionsButton.y = screenBottom - 15 local newButton = widget.newButton { x = centerX, y = centerY + 50, width = 800, height = 100, id = "newme", onRelease=buttonPressed, defaultFile = "images/btn-horse.png", overFile = "images/btn-horse-pressed.png" } local horseButton = widget.newButton { x = centerX, y = screenTop + 50, width = 400, height = 92, id = "choose", onRelease=buttonPressed, defaultFile = "images/btn-horse.png", overFile = "images/btn-horse-pressed.png" } local blankButton = widget.newButton { x = centerX, y = centerY + 20, width = 400, height = 92, id = "play", onRelease=buttonPressed, defaultFile = "images/btn-board.png", overFile = "images/btn-board-pressed.png", label = "Play", fontSize = 48, labelColor = { default={1,1,1}, over={0,0,0} } } local function cbSwitchListener(event) local status = event.target.isOn print("Switch is on: " .. tostring(status)) horseButton:setEnabled(status) end local cbButton = widget.newSwitch{ style = "checkbox", initialSwitchState = true, onPress = cbSwitchListener } cbButton.x = screenRight - 80 cbButton.y = horseButton.y + horseButton.height/2 + 10 end local function accessSwitchListener(event) local status = event.target.isOn print("Switch is on: " .. tostring(status)) horseButton:setEnabled(play) end local accessButton = widget.newSwitch{ style = "checkbox", initialSwitchState = true, onPress = accessSwitchListener } accessButton.x = screenRight - 160 accesssButton.y = horseButton.y + horseButton.height/2 + 10 end local function doScroll() local function onePic() end local function sixPics() end onePic() --sixPics() end doButtons() --doScroll()