mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Cosmetic changes to code.
This commit is contained in:
@ -19,7 +19,7 @@ void LuaManager::Init()
|
||||
{
|
||||
if (c_pState == 0)
|
||||
{
|
||||
// initialize Lua
|
||||
// initialize Lua
|
||||
c_pState = lua_open();
|
||||
|
||||
//load Lua base libraries
|
||||
@ -57,7 +57,7 @@ void LuaManager::ReportErrors(lua_State * L)
|
||||
{
|
||||
LuaLog(LOG_ERROR, "Script: %s", lua_tostring(L, -1));
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void LuaManager::LuaLog(int nLevel, const char* format, ... )
|
||||
{
|
||||
|
@ -21,14 +21,14 @@ std::wstring to_wstring(lua_State* L, int arg, void* type)
|
||||
|
||||
const wchar_t* to_wchar (lua_State* L, int arg, void* type)
|
||||
{
|
||||
// We have a static wstring here so we can keep a copy of the string
|
||||
// We have a static wstring here so we can keep a copy of the string
|
||||
// passed in alive while its being passed around.
|
||||
// This isn't exactly safe, but we shouldn't really have to worry as
|
||||
// Rainmeter isn't threaded.
|
||||
static std::wstring str;
|
||||
|
||||
str = ConvertToWide(lua_tostring(L,arg));
|
||||
|
||||
|
||||
return str.c_str();
|
||||
}
|
||||
|
||||
|
@ -16,11 +16,11 @@ LuaScript::LuaScript(lua_State* p_pState, const char* p_strFile) : m_pState(p_pS
|
||||
lua_newtable(m_pState);
|
||||
|
||||
// Create the metatable that will store the global table
|
||||
lua_createtable(m_pState, 0, 1);
|
||||
|
||||
lua_createtable(m_pState, 0, 1);
|
||||
|
||||
// Push the global teble
|
||||
lua_pushvalue(m_pState, LUA_GLOBALSINDEX);
|
||||
|
||||
|
||||
// Set the __index of the table to be the global table
|
||||
lua_setfield(m_pState, -2, "__index");
|
||||
|
||||
@ -102,7 +102,7 @@ double LuaScript::RunFunctionDouble(const char* p_strFuncName)
|
||||
// Push the function onto the stack
|
||||
lua_getfield(m_pState, -1, p_strFuncName);
|
||||
|
||||
if(lua_pcall(m_pState, 0, 1, 0))
|
||||
if (lua_pcall(m_pState, 0, 1, 0))
|
||||
{
|
||||
LuaManager::ReportErrors(m_pState);
|
||||
}
|
||||
@ -188,7 +188,7 @@ bool LuaScript::FunctionExists(const char* p_strFuncName)
|
||||
// Push the function onto the stack
|
||||
lua_getfield(m_pState, -1, p_strFuncName);
|
||||
|
||||
if (lua_isfunction( m_pState, -1))
|
||||
if (lua_isfunction( m_pState, -1))
|
||||
{
|
||||
bExists = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user