whoops. Move the Lua comment hack to the right place.

This commit is contained in:
Chris Danford
2004-09-24 04:55:28 +00:00
parent f8d3996b35
commit 81b7695c7e
2 changed files with 10 additions and 9 deletions
+2 -7
View File
@@ -99,20 +99,15 @@ bool Lua::GetStack( lua_State *L, int pos, int &out )
void LoadFromString( lua_State *L, const CString &str ) void LoadFromString( lua_State *L, const CString &str )
{ {
// HACK: Many metrics have "//" comments that Lua fails to parse.
// Replace them with Lua-style comments.
CString str2 = str;
str2.Replace( "//", "--" );
ChunkReaderData data; ChunkReaderData data;
data.buf = &str2; data.buf = &str;
int ret = lua_load( L, ChunkReaderString, &data, "in" ); int ret = lua_load( L, ChunkReaderString, &data, "in" );
if( ret ) if( ret )
{ {
CString err; CString err;
Lua::PopStack( L, err ); Lua::PopStack( L, err );
RageException::Throw( "Error loading script \"%s\": %s", str2.c_str(), err.c_str() ); RageException::Throw( "Error loading script \"%s\": %s", str.c_str(), err.c_str() );
} }
} }
+8 -2
View File
@@ -614,18 +614,24 @@ int ThemeManager::GetMetricI( CString sClassName, CString sValueName )
float ThemeManager::GetMetricF( CString sClassName, CString sValueName ) float ThemeManager::GetMetricF( CString sClassName, CString sValueName )
{ {
const CString str = GetMetricRaw( sClassName,sValueName ); CString str = GetMetricRaw( sClassName,sValueName );
// HACK: Many metrics have "//" comments that Lua fails to parse.
// Replace them with Lua-style comments.
str.Replace( "//", "--" );
return Lua::RunExpressionF( str ); return Lua::RunExpressionF( str );
} }
// #include "LuaHelpers.h" // #include "LuaHelpers.h"
bool ThemeManager::GetMetricB( CString sClassName, CString sValueName ) bool ThemeManager::GetMetricB( CString sClassName, CString sValueName )
{ {
const CString str = GetMetricRaw( sClassName,sValueName ); CString str = GetMetricRaw( sClassName,sValueName );
if( str == "0" ) if( str == "0" )
return false; /* optimization */ return false; /* optimization */
if( str == "1" ) if( str == "1" )
return true; /* optimization */ return true; /* optimization */
// HACK: Many metrics have "//" comments that Lua fails to parse.
// Replace them with Lua-style comments.
str.Replace( "//", "--" );
return Lua::RunExpressionB( str ); return Lua::RunExpressionB( str );
} }