Suppose I have 3 levels in my game. I have included them in two different ways. I can’t decide on which one to use.
The first
[lua]–levels.lua
local level1 = function() … end
local level2 = function() … end
local level3 = function() … end
return level1,level2,level3
–main.lua
local l1,l2,l3
l1,l2,l3 = require “levels”
l1();
l2();
l3();[/lua]
and the second
[lua]–level1.lua
local level1 = function() … end
return level1
–level2.lua
local level2 = function() … end
return level2
–level3.lua
local level3 = function() … end
return level3
–main.lua
local l1=require “level1”
local l2=require “level2”
local l3=require “level3”
l1();
l2();
l3()[/lua]
When running the game, I felt the first one was a bit slower. Particularly when executing the functions… i.e l1(); or l2();
I’m not sure though. When the no. levels increase, I guess the performance will decrease.
So anybody have any idea to which of the above two will be more effiecient with respect to game performance??
Any help is appreciated… Thanks
P.S. I have a number of levels and in each level function, I create a number of display objects
[import]uid: 64174 topic_id: 16590 reply_id: 316590[/import]
