From f2984b0dcf21f199d7fb6d6f856767810184ec05 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 5 Sep 2005 05:32:08 +0000 Subject: [PATCH] support loading precompiled Lua chunks, for faster loading--compiling Lua can be slow. --- stepmania/src/ActorCommands.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/stepmania/src/ActorCommands.cpp b/stepmania/src/ActorCommands.cpp index 12a95d2ad9..b56719238f 100644 --- a/stepmania/src/ActorCommands.cpp +++ b/stepmania/src/ActorCommands.cpp @@ -3,16 +3,21 @@ #include "Command.h" #include "Foreach.h" #include "RageUtil.h" +#include "RageLog.h" #include #include "LuaBinding.h" ActorCommands::ActorCommands( const CString &sCommands ) { - if( sCommands.size() > 0 && sCommands[0] == '%' ) + if( sCommands.size() > 4 && sCommands[1] == '\033' ) { + /* This is a compiled Lua chunk. Just pass it on directly. */ m_sLuaFunction = sCommands; - m_sLuaFunction.erase( m_sLuaFunction.begin() ); - m_sLuaFunction = "return " + m_sLuaFunction; + } + else if( sCommands.size() > 0 && sCommands[0] == '%' ) + { + m_sLuaFunction = "return "; + m_sLuaFunction.append( sCommands.begin()+1, sCommands.end() ); } else {