solarus-games/zsdx

Use require() instead of sol.main.load_file()

christopho opened this issue · 1 comments

sol.main.load_file() to include other scripts is bad practice, require() should be used instead.
To do replacement easily it in legacy code, remove the first line of the required scripts (local param = ...) and directly return a function:

return function(param)
    ....
end

And then just replace sol.main.load_file("script.lua")(param) by require("script")(param).

Same problem in zsxd, zelda_roth_se, zelda_olb_se and zelda_mercuris_chest.