From f8c70058290b3bc08f0666d2c43ca4d3087f20cd Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 24 Sep 2004 04:49:37 +0000 Subject: [PATCH] replace C style comments in metrics with Lua style. Yuck. --- stepmania/src/LuaHelpers.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/stepmania/src/LuaHelpers.cpp b/stepmania/src/LuaHelpers.cpp index 35a8150be8..8a8584e4bc 100644 --- a/stepmania/src/LuaHelpers.cpp +++ b/stepmania/src/LuaHelpers.cpp @@ -99,15 +99,20 @@ 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 = &str; + data.buf = &str2; int ret = lua_load( L, ChunkReaderString, &data, "in" ); if( ret ) { CString err; Lua::PopStack( L, err ); - RageException::Throw( "Error loading script \"%s\": %s", str.c_str(), err.c_str() ); + RageException::Throw( "Error loading script \"%s\": %s", str2.c_str(), err.c_str() ); } }