Not sure what you mean, but the easiest way is to put them into a table - OO-style:
[lua]game = {
level_1 = {},
level_2 = {},
level_3 = {}
}
function game.level_1:myFunction_1()
– CODE
end
function game.level_1:myFunction_2()
– CODE
end
function game.level_2:myFunction_1()
– CODE
end[/lua]
Also, you could also use more “logical” ways to write this:
[lua]game = {
functions = {},
curlevel = 1
}
function game.functions[1]:myFunction_1()
– CODE
end
function game.functions[1]:myFunction_2()
– CODE
end
function game.functions[2]:myFunction_1()
– CODE
end
– at some point, when you need them:
local funcs = game.functions[game.curlevel] – selects the current functions set
funcs:myFunction_1() – uses function 1[/lua]
This latter example also allows you to use same function names across different “levels”… if structure is similar, you can copy/paste most of the code from the first level!
[import]uid: 5750 topic_id: 3812 reply_id: 11582[/import]