int CLuaFunctionDefs::OutputDebugString ( lua_State* luaVM ) { SString strMessage; unsigned int uiLevel; unsigned char ucR, ucG, ucB; CScriptArgReader argStream ( luaVM ); argStream.ReadAnyAsString( strMessage ); argStream.ReadNumber ( uiLevel, 3 ); if ( uiLevel == 0 ) { argStream.ReadNumber ( ucR, 0xFF ); argStream.ReadNumber ( ucG, 0xFF ); argStream.ReadNumber ( ucB, 0xFF ); } if ( !argStream.HasErrors () ) { if ( uiLevel > 3 ) { m_pScriptDebugging->LogWarning ( luaVM, "Bad level argument sent to %s (0-3)", lua_tostring ( luaVM, lua_upvalueindex ( 1 ) ) ); lua_pushboolean ( luaVM, false ); return 1; } if ( uiLevel == 1 ) { m_pScriptDebugging->LogError ( luaVM, "%s", strMessage.c_str () ); } else if ( uiLevel == 2 ) { m_pScriptDebugging->LogWarning ( luaVM, "%s", strMessage.c_str () ); } else if ( uiLevel == 3 ) { m_pScriptDebugging->LogInformation ( luaVM, "%s", strMessage.c_str () ); } else if ( uiLevel == 0 ) { m_pScriptDebugging->LogCustom ( luaVM, ucR, ucG, ucB, "%s", strMessage.c_str () ); } lua_pushboolean ( luaVM, true ); return 1; } else m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () ); lua_pushboolean ( luaVM, false ); return 1; }