Functions within tables

I'm a noob, and I'm sure theres a really simple answer to this but I can seem to find it! If I store list of functions in a table - how do I then run one of those functions from the table - see sample code below...

1
2
3
4
5
6
7
8
9
10
11
12
myTable = { 
func1,
func2
}
 
local function randomPick()
int1 = math.random (2)
myTable[int1]
 
end
 
randomPick()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
func1 = function()
print("one")
end
func2 = function()
print("two")
end
 
myTable = { 
func1,
func2
}
 
local function randomPick()
int1 = math.random (2)
myTable[int1]()
 
end
 
randomPick()

thank you! I knew it would be something stupid I was doing wrong....!

views:1522 update:2012/1/9 8:53:30
corona forums © 2003-2011