is there a way to group together functions into a group (ie different levels have different functions that shouldnt trigger outside their respective levels( so that they dont run into the next level)
thanks in advance [import]uid: 10239 topic_id: 3812 reply_id: 303812[/import]
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]