diff --git a/stepmania/src/LuaHelpers.cpp b/stepmania/src/LuaHelpers.cpp index a4ab76dae3..e5f1d4d8a5 100644 --- a/stepmania/src/LuaHelpers.cpp +++ b/stepmania/src/LuaHelpers.cpp @@ -149,6 +149,12 @@ try { } RAGE_ASSERT_M( lua_gettop(L) == 1, ssprintf("%i", lua_gettop(L)) ); + + /* Don't accept a function as a return value; if you really want to use a function + * as a boolean, convert it before returning. */ + if( lua_isfunction( L, -1 ) ) + throw CString( "result is a function; did you forget \"()\"?" ); + bool result = !!lua_toboolean( L, -1 ); lua_pop( L, -1 );