1818#include " platform/Logger.h"
1919#include " Wrappers.h"
2020
21- // #ifdef COMPILE_LUA_SCRIPTS
21+ #ifdef COMPILE_LUA_SCRIPTS
2222#include " generated/CompiledScripts.h"
23- // #endif
23+ #endif
24+
25+ // #define DEBUG_SCRIPTS
2426
2527void UiLuaContext::init (AudioContextProxy* proxy, const std::string& path, const std::string& scriptPath) {
2628 _configPath = path;
@@ -47,7 +49,7 @@ bool UiLuaContext::onKey(VirtualKey key, bool down) {
4749 return res;
4850 }
4951
50- return false ;
52+ return false ;
5153}
5254
5355void UiLuaContext::onDoubleClick (float x, float y, MouseMod mod) {
@@ -91,14 +93,14 @@ void UiLuaContext::reload() {
9193 if (_valid) {
9294 callFunc (_viewRoot, " onReloadBegin" );
9395 }
94-
96+
9597 shutdown ();
9698 setup (false );
9799
98100 if (_valid) {
99101 callFunc (_viewRoot, " onReloadEnd" );
100102 }
101-
103+
102104 _haltFrameProcessing = !_valid;
103105}
104106
@@ -141,13 +143,13 @@ bool UiLuaContext::setup(bool updateProject) {
141143 _state = new sol::state ();
142144 sol::state& s = *_state;
143145
144- s.open_libraries ( sol::lib::base, sol::lib::package, sol::lib::table, sol::lib::string,
146+ s.open_libraries ( sol::lib::base, sol::lib::package, sol::lib::table, sol::lib::string,
145147 sol::lib::math, sol::lib::debug, sol::lib::coroutine, sol::lib::io );
146148
147149 std::string packagePath = s[" package" ][" path" ];
148150 packagePath += " ;" + _configPath + " /?.lua" ;
149151
150- #ifdef COMPILE_LUA_SCRIPTS
152+ #ifndef DEBUG_SCRIPTS
151153 spdlog::info (" Using precompiled lua scripts" );
152154 s.add_package_loader (CompiledScripts::common::loader);
153155 s.add_package_loader (CompiledScripts::ui::loader);
@@ -158,7 +160,7 @@ bool UiLuaContext::setup(bool updateProject) {
158160#endif
159161
160162 s[" package" ][" path" ] = packagePath;
161-
163+
162164 luawrappers::registerCommon (s);
163165 luawrappers::registerChrono (s);
164166 luawrappers::registerLsdj (s);
@@ -191,7 +193,7 @@ bool UiLuaContext::setup(bool updateProject) {
191193 );
192194
193195 // TODO: Fix naming of this too!
194- s.create_named_table (" nativeutil" ,
196+ s.create_named_table (" nativeutil" ,
195197 " mergeMenu" , mergeMenu
196198 );
197199
@@ -223,7 +225,7 @@ bool UiLuaContext::setup(bool updateProject) {
223225 }
224226
225227 // Load the users config settings
226- // TODO: This should probably happen outside of this class since it may be used by the
228+ // TODO: This should probably happen outside of this class since it may be used by the
227229 // audio lua context too.
228230 std::string configPath = _configPath + " /config.lua" ;
229231 bool configValid = false ;
0 commit comments