@@ -313,23 +313,26 @@ void Engine::InitSubSystems()
313313 // Get lua to look for scripts in the correction location
314314 mLuaState .script (" package.path = '" + mFileSystem ->FsPath () + " data/scripts/?.lua'" );
315315
316- mSquirrelVm .defun (" log_info" , LuaLogInfo);
317- mSquirrelVm .defun (" log_trace" , LuaLogTrace);
318- mSquirrelVm .defun (" log_warning" , LuaLogWarning);
319- mSquirrelVm .defun (" log_error" , LuaLogError);
316+ Sqrat::DefaultVM::Set (mSquirrelVm .Handle ());
320317
321- Sqrat::DefaultVM::Set (mSquirrelVm .handle ());
318+ Sqrat::RootTable ().Func (" log_info" , LuaLogInfo);
319+ Sqrat::RootTable ().Func (" log_trace" , LuaLogTrace);
320+ Sqrat::RootTable ().Func (" log_warning" , LuaLogWarning);
321+ Sqrat::RootTable ().Func (" log_error" , LuaLogError);
322322
323323 Oddlib::IStream::RegisterScriptBindings (mLuaState );
324324 Actions::RegisterScriptBindings (mLuaState );
325325 MapObject::RegisterScriptBindings (mLuaState );
326326 ObjRect::RegisterScriptBindings (mLuaState );
327327
328328 // TODO: Override the stdout/stderr/compile error functions to LOG's
329- mSquirrelVm .dostring (mResourceLocator ->LocateScript (" main.nut" ).c_str ());
329+ Sqrat::Script script;
330+ script.CompileString (mResourceLocator ->LocateScript (" main.nut" ));
331+ script.Run ();
330332
331333 LOG_INFO (" Calling script init()" );
332- mSquirrelVm .call <void >(" init" );
334+ Sqrat::Function initFunc (Sqrat::RootTable (), " init" );
335+ initFunc.Execute ();
333336}
334337
335338// TODO: Using averaging value or anything that is more accurate than this
@@ -577,7 +580,8 @@ void Engine::Update()
577580 Debugging ().Update (mInputState );
578581
579582 // HACK: Should be called from within the "init/starting" state
580- mSquirrelVm .call <void >(" update" );
583+ Sqrat::Function initFunc (Sqrat::RootTable (), " update" );
584+ initFunc.Execute ();
581585
582586 mStateMachine .Update (mInputState , *mRenderer );
583587}
0 commit comments