static int GetName(lua_State* L) { CMeasure* self = GetSelf(L); LuaManager::PushWide(L, self->GetName()); return 1; }
void ChannelHandler::SendPublicMessage (const QString& msg) { if (GetSelf () == ChannelParticipantEntry_ptr ()) return; CM_->SendPublicMessage (ChannelOptions_.ChannelName_, msg); }
static int Hide(lua_State* L) { CMeter* self = GetSelf(L); self->Hide(); return 0; }
static int Show(lua_State* L) { CMeter* self = GetSelf(L); self->Show(); return 0; }
static int GetW(lua_State* L) { CMeter* self = GetSelf(L); lua_pushnumber(L, self->GetW()); return 1; }
static int GetValueRange(lua_State* L) { CMeasure* self = GetSelf(L); lua_pushnumber(L, self->GetValueRange()); return 1; }
static int Enable(lua_State* L) { CMeasure* self = GetSelf(L); self->Enable(); return 0; }
//-------------------------------------------------------------- // Name: setupStateMoveToNode() // Class: GotoCurrentHelperNode // // Description: Sets up the Move To Cover State // // Parameters: None // // Returns: None //-------------------------------------------------------------- void GotoCurrentHelperNode::setupStateMoveToNode() { _gotoPoint.SetAnim( _movementAnim ); _gotoPoint.SetDistance( NODE_RADIUS ); _gotoPoint.SetPoint( _node->origin ); _gotoPoint.Begin( *GetSelf() ); }
static int Bang(lua_State* L) { CMeterWindow* self = GetSelf(L); CConfigParser& parser = self->GetParser(); std::wstring bang = LuaManager::ToWide(L, 2); int top = lua_gettop(L); if (top == 2) // 1 argument { parser.ReplaceVariables(bang); Rainmeter->ExecuteCommand(bang.c_str(), self); } else { const WCHAR* bangSz = bang.c_str(); if (*bangSz == L'!') { ++bangSz; // Skip "!" std::vector<std::wstring> args; for (int i = 3; i <= top; ++i) { std::wstring tmpSz = LuaManager::ToWide(L, i); parser.ReplaceVariables(tmpSz); args.push_back(tmpSz); } Rainmeter->ExecuteBang(bangSz, args, self); } } return 0; }
static int GetY(lua_State* L) { CMeter* self = GetSelf(L); bool abs = (bool)lua_toboolean(L, 2); lua_pushnumber(L, self->GetY(abs)); return 1; }
static int SetH(lua_State* L) { CMeter* self = GetSelf(L); int h = (int)lua_tonumber(L, 2); self->SetH(h); return 0; }
static int MoveWindow(lua_State* L) { CMeterWindow* self = GetSelf(L); int x = (int)lua_tonumber(L, 2); int y = (int)lua_tonumber(L, 3); self->MoveWindow(x, y); return 0; }
static int MakePathAbsolute(lua_State* L) { CMeterWindow* self = GetSelf(L); std::wstring path = LuaManager::ToWide(L, 2); self->MakePathAbsolute(path); LuaManager::PushWide(L, path.c_str()); return 1; }
static int FadeWindow(lua_State* L) { CMeterWindow* self = GetSelf(L); int from = (int)lua_tonumber(L, 2); int to = (int)lua_tonumber(L, 3); self->FadeWindow(from, to); return 0; }
//-------------------------------------------------------------- // Name: evaluateStateMoveToNode() // Class: GotoCurrentHelperNode // // Description: Evaluates the Move To Cover State // // Parameters: None // // Returns: None //-------------------------------------------------------------- BehaviorReturnCode_t GotoCurrentHelperNode::evaluateStateMoveToNode() { BehaviorReturnCode_t result = _gotoPoint.Evaluate( *GetSelf() ); str failureReason = "GotoCurrentHelperNode::evaluateStateMoveToNode -- _gotoPoint component returned: " + _gotoPoint.GetFailureReason(); if ( result == BEHAVIOR_FAILED ) failureStateMoveToNode( failureReason ); return result; }
static int ReplaceVariables(lua_State* L) { CMeterWindow* self = GetSelf(L); std::wstring strTmp = LuaManager::ToWide(L, 2); self->GetParser().ReplaceVariables(strTmp); self->GetParser().ReplaceMeasures(strTmp); LuaManager::PushWide(L, strTmp.c_str()); return 1; }
static int SetText(lua_State* L) { CMeter* self = GetSelf(L); if (self->GetTypeID() == TypeID<CMeterString>()) { CMeterString* string = (CMeterString*)self; std::wstring str = LuaManager::ToWide(L, 2); string->SetText(str.c_str()); } return 0; }
static int GetOption(lua_State* L) { CMeasure* self = GetSelf(L); CMeterWindow* meterWindow = self->GetMeterWindow(); CConfigParser& parser = meterWindow->GetParser(); std::wstring strTmp = LuaManager::ToWide(L, 2); strTmp = parser.ReadString(self->GetName(), strTmp.c_str(), LuaManager::ToWide(L, 3).c_str()); LuaManager::PushWide(L, strTmp.c_str()); return 1; }
static int GetNumberOption(lua_State* L) { CMeasure* self = GetSelf(L); CMeterWindow* meterWindow = self->GetMeterWindow(); CConfigParser& parser = meterWindow->GetParser(); std::wstring strTmp = LuaManager::ToWide(L, 2); double value = parser.ReadFormula(self->GetName(), strTmp.c_str(), lua_tonumber(L, 3)); lua_pushnumber(L, value); return 1; }
void Interpreter::doPopField(long bytecodeIndex) { uint8_t field_index = method->GetBytecode(bytecodeIndex + 1); vm_oop_t self = GetSelf(); vm_oop_t o = GetFrame()->Pop(); if (unlikely(IS_TAGGED(self))) { GetUniverse()->ErrorExit("Integers do not have fields that can be set"); } else { ((VMObject*) self)->SetField(field_index, o); } }
static int GetStringValue(lua_State* L) { CMeasure* self = GetSelf(L); int top = lua_gettop(L); AUTOSCALE autoScale = (top > 1) ? (AUTOSCALE)(int)lua_tonumber(L, 2) : AUTOSCALE_OFF; double scale = (top > 2) ? lua_tonumber(L, 3) : 1.0; int decimals = (int)lua_tonumber(L, 4); bool percentual = lua_toboolean(L, 5); const WCHAR* val = self->GetStringValue(autoScale, scale, decimals, percentual); LuaManager::PushWide(L, val); return 1; }
void Interpreter::doPushField(long bytecodeIndex) { uint8_t fieldIndex = method->GetBytecode(bytecodeIndex + 1); vm_oop_t self = GetSelf(); vm_oop_t o; if (unlikely(IS_TAGGED(self))) { o = nullptr; Universe()->ErrorExit("Integers do not have fields!"); } else { o = ((VMObject*)self)->GetField(fieldIndex); } GetFrame()->Push(o); }
static int ParseFormula(lua_State* L) { CMeterWindow* self = GetSelf(L); std::wstring strTmp = LuaManager::ToWide(L, 2); double result; if (!self->GetParser().ParseFormula(strTmp, &result)) { result = lua_tonumber(L, 2); } lua_pushnumber(L, result); return 1; }
static int GetVariable(lua_State* L) { CMeterWindow* self = GetSelf(L); std::wstring strTmp = LuaManager::ToWide(L, 2); const std::wstring* value = self->GetParser().GetVariable(strTmp); if (value) { LuaManager::PushWide(L, (*value).c_str()); } else { lua_pushnil(L); } return 1; }
static int GetMeasure(lua_State* L) { CMeterWindow* self = GetSelf(L); const std::wstring measureName = LuaManager::ToWide(L, 2); CMeasure* measure = self->GetMeasure(measureName); if (measure) { *(CMeasure**)lua_newuserdata(L, sizeof(CMeasure*)) = measure; lua_getglobal(L, "CMeasure"); lua_setmetatable(L, -2); } else { lua_pushnil(L); } return 1; }
void Interpreter::doPushGlobal(long bytecodeIndex) { VMSymbol* globalName = static_cast<VMSymbol*>(method->GetConstant(bytecodeIndex)); vm_oop_t global = GetUniverse()->GetGlobal(globalName); if (global != nullptr) GetFrame()->Push(global); else { vm_oop_t arguments[] = {globalName}; vm_oop_t self = GetSelf(); //check if there is enough space on the stack for this unplanned Send //unknowGlobal: needs 2 slots, one for "this" and one for the argument long additionalStackSlots = 2 - GetFrame()->RemainingStackSize(); if (additionalStackSlots > 0) { GetFrame()->SetBytecodeIndex(bytecodeIndexGlobal); //copy current frame into a bigger one and replace the current frame SetFrame(VMFrame::EmergencyFrameFrom(GetFrame(), additionalStackSlots)); } AS_OBJ(self)->Send(unknownGlobal, arguments, 1); } }
void WatchEntity::setupStateHold() { _animDone = false; GetSelf()->SetAnim( _holdAnim , EV_Actor_NotifyBehavior , legs ); }
//-------------------------------------------------------------- // Name: setupStateFindNode() // Class: GotoCurrentHelperNode // // Description: Sets up the Find State // // Parameters: None // // Returns: None //-------------------------------------------------------------- void GotoCurrentHelperNode::setupStateFindNode() { _node = GetSelf()->currentHelperNode.node; }