whoops. Move the Lua comment hack to the right place.
This commit is contained in:
@@ -99,20 +99,15 @@ bool Lua::GetStack( lua_State *L, int pos, int &out )
|
||||
|
||||
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;
|
||||
data.buf = &str2;
|
||||
data.buf = &str;
|
||||
int ret = lua_load( L, ChunkReaderString, &data, "in" );
|
||||
|
||||
if( ret )
|
||||
{
|
||||
CString 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() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -614,18 +614,24 @@ int ThemeManager::GetMetricI( 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 );
|
||||
}
|
||||
|
||||
// #include "LuaHelpers.h"
|
||||
bool ThemeManager::GetMetricB( CString sClassName, CString sValueName )
|
||||
{
|
||||
const CString str = GetMetricRaw( sClassName,sValueName );
|
||||
CString str = GetMetricRaw( sClassName,sValueName );
|
||||
if( str == "0" )
|
||||
return false; /* optimization */
|
||||
if( str == "1" )
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user