Skip to content

Commit

Permalink
Fixed Lua ScriptCompiler constructor not calling SetupCompiler
Browse files Browse the repository at this point in the history
  • Loading branch information
dedmen committed May 7, 2021
1 parent 1999555 commit 1aff2fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions sqfc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ compiler:AddMacro(Macro.new("MY_MACRO_CUSTOM_ARGS", {"arg1", "arg2"},
end
));

print("Preprocessed Script: \n", compiler:PreprocessFile(path.new("P:/test.sqf")));
-- print("Preprocessed Script: \n", compiler:PreprocessFile(path.new("P:\\test.sqf")));


function optimizerNodeHandler(node)
Expand Down Expand Up @@ -163,5 +163,6 @@ end
local optimizer = OptimizerModuleLua.new(optimizerNodeHandler)


compiler:CompileScriptToFile(path.new("P:/test.sqf"), path.new("P:/test.asm"), optimizer)
--compiler:CompileScriptToFile(path.new("P:\\test.sqf"), path.new("P:/test.asm"), optimizer)
compiler:CompileScriptToFile(path.new("T:\\z\\ace\\addons\\common\\functions\\fnc_cbaSettings_loadFromConfig.sqf"), path.new("P:/test.asm"), optimizer)

8 changes: 7 additions & 1 deletion src/luaHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,13 @@ LuaHandler::LuaHandler() {


lua.new_usertype<ScriptCompiler>(
"ScriptCompiler", sol::default_constructor,
"ScriptCompiler", sol::no_constructor,
"new", []()
{
ScriptCompiler compiler;
GLuaHandler.SetupCompiler(compiler);
return compiler;
},

"InitIncludePaths", [](ScriptCompiler& comp, sol::table paths)
{
Expand Down

0 comments on commit 1aff2fc

Please sign in to comment.