History

Added script types and better script reload

luiscuenca committed 8 years ago

Commit 2de982a1 parent 12f578c12 files · +81 −33Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 12 files). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+14−0
@@ -180,6 +180,20 @@ ScriptEngine::ScriptEngine(Context context, const QString& scriptContents, const · 179 unmodified lines
180 // don't delete `ScriptEngines` until all `ScriptEngine`s are gone180 // don't delete `ScriptEngines` until all `ScriptEngine`s are gone
181 _scriptEngines(DependencyManager::get<ScriptEngines>())181 _scriptEngines(DependencyManager::get<ScriptEngines>())
182{182{
183 switch (_context) {
184 case Context::CLIENT_SCRIPT:
185 _type = Type::CLIENT;
186 break;
187 case Context::ENTITY_CLIENT_SCRIPT:
188 _type = Type::ENTITY_CLIENT;
189 break;
190 case Context::ENTITY_SERVER_SCRIPT:
191 _type = Type::ENTITY_SERVER;
192 break;
193 case Context::AGENT_SCRIPT:
194 _type = Type::AGENT;
195 }
196
183 connect(this, &QScriptEngine::signalHandlerException, this, [this](const QScriptValue& exception) {197 connect(this, &QScriptEngine::signalHandlerException, this, [this](const QScriptValue& exception) {
184 if (hasUncaughtException()) {198 if (hasUncaughtException()) {
185 // the engine's uncaughtException() seems to produce much better stack traces here199 // the engine's uncaughtException() seems to produce much better stack traces here