Syntax error: \code\main.lua:11: '(' expected near 'if'

Heres the code:

Line 11 is this: “if sound == 1 then” I dont see whats wrong…

local ui = require("ui") local sound = 1 function createoptions -- clearmainmenu() if sound == 1 then --Sound is ON Sound = ui.newButton { default = "buttonRed.png", over = "buttonRedOver.png", onPress = togglesound(1), onRelease = togglesound(1), text = "On", emboss = true } else Sound = ui.newButton{ default = "buttonRed.png", over = "buttonRedOver.png", onPress = togglesound(0), onRelease = togglesound(0), text = "Off", emboss = true } end end [import]uid: 44393 topic_id: 8022 reply_id: 308022[/import]

you forgot the brackets for the function:

[lua]function createoptions()[/lua] [import]uid: 42078 topic_id: 8022 reply_id: 28601[/import]

Ah thanks.

I thought you didn’t need to add brackets if you aren’t passing any variables. [import]uid: 44393 topic_id: 8022 reply_id: 28641[/import]