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..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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

you forgot the brackets for the function:

1
function createoptions()

Ah thanks.

I thought you didn't need to add brackets if you aren't passing any variables.

views:2149 update:2011/10/6 9:28:12
corona forums © 2003-2011