mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
- Added !CommandMeasure bang. Instead of '!PluginBang "MeasureName Arguments' use '!CommandMeasure "MeasureName" "Arguments"'.
- Script: The !CommandMeasure argument must now be Lua code. For example: !CommandMeasure "MeasureLuaScript" "someVar = 'hello'" !CommandMeasure "MeasureLuaScript" "SomeFunc()"
This commit is contained in:
@ -189,6 +189,35 @@ bool LuaScript::RunFunctionWithReturn(const char* funcName, double& numValue, st
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
** RunString
|
||||
**
|
||||
** Runs given string in the context of the script file.
|
||||
**
|
||||
*/
|
||||
void LuaScript::RunString(const char* str)
|
||||
{
|
||||
if (m_Initialized)
|
||||
{
|
||||
// Load the string as a Lua chunk
|
||||
if (luaL_loadstring(m_State, str))
|
||||
{
|
||||
LuaManager::ReportErrors(m_State);
|
||||
}
|
||||
|
||||
// Push our table onto the stack
|
||||
PushTable();
|
||||
|
||||
// Pop table and set the environment of the loaded chunk to it
|
||||
lua_setfenv(m_State, -2);
|
||||
|
||||
if (lua_pcall(m_State, 0, 0, 0))
|
||||
{
|
||||
LuaManager::ReportErrors(m_State);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//void LuaScript::BindVariable(const char* p_strName, void* p_pValue, const char* p_strTypeName)
|
||||
//{
|
||||
// PushTable();
|
||||
|
@ -33,8 +33,7 @@ public:
|
||||
bool IsFunction(const char* funcName);
|
||||
void RunFunction(const char* funcName);
|
||||
bool RunFunctionWithReturn(const char* funcName, double& numValue, std::wstring& strValue);
|
||||
|
||||
static void ReportErrors(lua_State* L);
|
||||
void RunString(const char* str);
|
||||
|
||||
protected:
|
||||
lua_State* m_State;
|
||||
|
Reference in New Issue
Block a user