Minor tweaks and cosmetics.

This commit is contained in:
Birunthan Mohanathas
2012-03-02 10:04:08 +00:00
parent 4766da1c53
commit 4a7ef7508f
4 changed files with 7 additions and 33 deletions

View File

@@ -23,7 +23,7 @@
int LuaManager::c_RefCount = 0;
lua_State* LuaManager::c_State = 0;
void LuaManager::Init()
void LuaManager::Initialize()
{
if (c_State == NULL)
{
@@ -51,7 +51,7 @@ void LuaManager::Init()
++c_RefCount;
}
void LuaManager::CleanUp()
void LuaManager::Finalize()
{
if (c_RefCount > 0)
{
@@ -84,31 +84,6 @@ void LuaManager::ReportErrors(lua_State* L)
Log(LOG_ERROR, str.c_str());
}
void LuaManager::LuaLog(int nLevel, const char* format, ... )
{
char* buffer = new char[4096];
va_list args;
va_start( args, format );
_invalid_parameter_handler oldHandler = _set_invalid_parameter_handler(RmNullCRTInvalidParameterHandler);
_CrtSetReportMode(_CRT_ASSERT, 0);
errno = 0;
_vsnprintf_s( buffer, 4096, _TRUNCATE, format, args );
if (errno != 0)
{
_snprintf_s(buffer, 4096, _TRUNCATE, "Script: LuaLog internal error: %s", format);
}
_set_invalid_parameter_handler(oldHandler);
std::wstring str = ConvertToWide(buffer);
Log(nLevel, str.c_str());
va_end(args);
delete [] buffer;
}
void LuaManager::PushWide(lua_State* L, const WCHAR* str)
{
lua_pushstring(L, ConvertToAscii(str).c_str());