You make your our game with love and you have a load() function longer than 2 pages ?
Then love-master is for you !
love-master provide a interface to "replace" the default love callbacks.
Before:
Code: Select all
function load()
do a 1st thing
do a 2nd thing
do a 3rd thing
end
Code: Select all
love.filesystem.require("love-master.lua")
master.autoinstall()
love.load:add("1st_thing", function()
do a 1st thing
end)
love.load:add("2nd_thing", function()
do a 2nd thing
end)
love.load:add("3rd_thing", function()
do a 3rd thing
end)
function load()
love.load:eval()
end
with a list of constraints, a string : prefix+name
prefix can be :
">" = after
"<" = before
You can have :
Code: Select all
love.filesystem.require("love-master.lua")
master.autoinstall()
love.load:add("3rd_thing", function()
do a 3rd thing
end)
love.load:add("1st_thing", function()
do a 1st thing
end, {"<3rd_thing"})
love.load:add("2nd_thing", function()
do a 2nd thing
end, {">1st_thing","<3rd_thing"})
function load()
love.load:eval()
end
In my own game projet I got something like :
Code: Select all
dump of load :
ORDER NAME CONSTRAINTS
1 show_client_version []
2 set_screen_var [--nodep]
3 set_title [>set_screen_var]
4 memorystart [--nodep]
5 memory_stat_1 [>memorystart]
6 logsystem []
7 memory_stat_2 []
8 load:lua50compat [--nodep]
9 load:libargs [--nodep]
10 load:pointer [--nodep]
11 load:path [>load:libargs]
12 bugdetect [>load:path,--path-is-optionnal]
13 load:encode [--nodep]
14 load:dump [--nodep]
15 load:loadsave [>load:encode,>load:path]
16 loadsave_part []
17 init_config_var []
18 set_config_defauts []
19 j2h.conf []
20 restore_settings []
21 save_settings []
22 memory_stat_3 []
23 set_default_font []
24 load:love.const []
25 load:metatablesort []
26 load:layers []
27 load:draw []
28 load:xmlrpc/workaround []
29 load:xmlrpc-client []
30 load:tree []
31 load:box []
32 load:stack []
33 load:draw2 []
34 load:drawitem []
35 load:input []
36 load:ail_init []
37 load:calcul []
38 memory_stat_4 []
39 load:colors []
40 constants_definition []
41 images []
42 load:camera []
43 camera_init [>load:camera]
44 load:boxloader []
45 items_init []
46 debug:dump_items []
dump of update :
ORDER NAME CONSTRAINTS
1 patch:update [--autopatched]
dump of draw :
ORDER NAME CONSTRAINTS
1 patch:draw [--autopatched]
dump of keypressed :
ORDER NAME CONSTRAINTS
1 patch:keypressed [--autopatched]
dump of keyreleased :
ORDER NAME CONSTRAINTS
1 patch:keyreleased [--autopatched]
dump of mousepressed :
ORDER NAME CONSTRAINTS
1 patch:mousepressed [--autopatched]
dump of mousereleased :
ORDER NAME CONSTRAINTS
1 patch:mousereleased [--autopatched]
dump of joystickpressed : empty.
dump of joystickreleased : empty.
To be continue...
Good night