Syntax error: E:\main.lua:54: unexpected symbol near '['

Could someone please help me with this?
Here's the code

1
2
3
4
5
6
7
8
9
10
11
function CreateLevelSelect()
        local Level = { }
        for i=1,10,1 do
                local Level[i] = ui.newButton {
                        default = "Levelbutton.png",
                        onRelease = StartLevel(i),
                        text = i,
                        emboss = true           
                }
        end
end

remove the word local in front of Level[i]

also your onRelease function won't work.. whenever you add () on the end of a function it calls it immediately.

since I don't know how the rest of your code is set up the simplest solution is to wrap it in an anonymous function closure

onRelease = function() StartLevel(i) end,

Thank you sir.

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