← 목록

mLua · 문서 코드 예제

총 794개 · 페이지 2/27
🔀 랜덤
불러오는 중…

[source] | examples [title] | InputService [page] | apiReference/Services/InputService [code] | Method: [server only] void OnBeginPlay () { local root = _EntityService:GetEntityByPath(EntityPath) for i = 1, #root.Children do root.Children[i].Enable = false end } Event Handler: [service: InputService] HandleScreenTouchEvent (ScreenTouchEvent event) { --------------- Native Event Sender I

[source] | examples [title] | InputService [page] | apiReference/Services/InputService [code] | Property: [None] string CursorRUID_Normal = "3930c5d2e85b4bff8467aada64fda7f5" [None] string CursorRUID_Click = "79819392249746f88952f3b2321f2f17" [None] boolean IsClicking = nil Method: [client only] void OnUpdate (number delta) { local click = _InputService:IsKeyPressed(KeyboardKey.Mouse0) i

[source] | examples [title] | LocalizationService [page] | apiReference/Services/LocalizationService [code] | Method: [clinet only] void OnBeginPlay() { -- 현재 언어 설정에 해당하는 컬럼의 텍스트를 가져옵니다. local plainText = _LocalizationService:GetText("TEXT_TEST1") -- 영어(en) 컬럼을 조회하는 Translator. local enTranslator = _LocalizationService:GetTranslatorForLocale("en") -- 현재 언어 설정(ko)에 해당하는 컬럼을 조회하는 Translator. local

[source] | examples [title] | LocalizationService [page] | apiReference/Services/LocalizationService [code] | local subjects = {"I", "You", "We", "They", "He", "She", "It"} for _, s in ipairs(subjects) do log(_LocalizationService:SmartFormat( "{0} {0:choose(I|You|We|They):am|are|are|are|is} ready.", s)) end -- Result -- -- I am ready. -- You are ready. -- We are ready. -- They are ready. -- It is ready.

[source] | examples [title] | DataStorageService [page] | apiReference/Services/DataStorageService [code] | local sampleStorage = _DataStorageService:GetGlobalDataStorage("sampleStorage")

[source] | examples [title] | DataStorageService [page] | apiReference/Services/DataStorageService [code] | _DataStorageService:GetGlobalDataStoragePagesAsync(function(errorCode, pages) if errorCode ~= 0 then return end while true do local dataStorages = pages:GetCurrentPageDatas() for i, dataStorage in ipairs(dataStorages) do _DataStorageService:DeleteGlobalDataStorageAndWait(dataStorage.Name

[source] | examples [title] | ItemService [page] | apiReference/Services/ItemService [code] | Event Handler: [self] HandleTriggerEnterEvent (TriggerEnterEvent event) { -- Parameters local TriggerBodyEntity = event.TriggerBodyEntity -------------------------------------------------------- if self:IsClient() then return end local inventory = self.Entity.InventoryComponent local ite

[source] | examples [title] | UserService [page] | apiReference/Services/UserService [code] | Event Handler: [server only] [service: UserService] HandleUserEnterEvent (UserEnterEvent event) { -- Parameters local UserId = event.UserId -------------------------------------------------------- local userEntity = _UserService:GetUserEntityByUserId(UserId) local nametag = userEntity.NameTa

[source] | examples [title] | EntityService [page] | apiReference/Services/EntityService [code] | [server] void DestroyTargetEntity (string id) { local entity = _EntityService:GetEntity(id) _EntityService:Destroy(entity) }

[source] | examples [title] | EntityService [page] | apiReference/Services/EntityService [code] | [server] void EnablePathEntities (string path, boolean enable) { local entities = _EntityService:GetEntitiesByPath(path) for k, v in pairs(entities) do v.Enable = enable end }

[source] | examples [title] | EntityService [page] | apiReference/Services/EntityService [code] | [server] void VisibleTagEntities (string tag, boolean visible) { local entities = _EntityService:GetEntitiesByTag(tag) for k, v in pairs(entities) do v.Visible = visible end }

[source] | examples [title] | EntityService [page] | apiReference/Services/EntityService [code] | [server] void JumpMoveMonsters () { local entities = _EntityService:GetEntitiesSpawnedByModelId("model://movemonster") for k, v in pairs(entities) do v.RigidbodyComponent:AddForce(Vector2(0.0, 5.0)) end }

[source] | examples [title] | CameraService [page] | apiReference/Services/CameraService [code] | Event Handler: [service: InputService] HandleKeyDownEvent (KeyDownEvent event) { -- Parameters local key = event.key -------------------------------------------------------- if key == KeyboardKey.LeftShift then local targetEntity = _EntityService:GetEntityByPath(EntityPath) local targetCa

[source] | examples [title] | TeleportService [page] | apiReference/Services/TeleportService [code] | Event Handler: [service: InputService] HandleKeyDownEvent (KeyDownEvent event) { -- Parameters local key = event.key -------------------------------------------------------- if key == KeyboardKey.LeftShift then local me = _UserService.LocalPlayer local currentMapName = me.CurrentM

[source] | examples [title] | SoundService [page] | apiReference/Services/SoundService [code] | Method: [client only] void OnBeginPlay() { local defaultUIGroup = _EntityService:GetEntityByPath("/ui/DefaultGroup") if defaultUIGroup == nil then return end _SoundService:PlayBGM("92dc353287df4b7894dfcec950edea49", 1) local buttonClickCallback = function() if _SoundService:IsPlayBGM(

[source] | examples [title] | SoundService [page] | apiReference/Services/SoundService [code] | Method: [client only] void OnBeginPlay() { local defaultUIGroup = _EntityService:GetEntityByPath("/ui/DefaultGroup") if defaultUIGroup == nil then return end -- 5초 동안 음원을 다섯번 재생합니다. for i=1, 5 do _SoundService:PlayLoopSound("0b52c64808f149e18532ec75417d27e1", 1) wait(1) end local

[source] | examples [title] | CustomFootholdComponent [page] | apiReference/Components/CustomFootholdComponent [code] | local target = _EntityService:GetEntityByPath(EntityPath) -- 요소의 값을 수정하면 변경 사항이 발판에 적용되지 않습니다. -- target.CustomFootholdComponent.edgeLists[1][1] = Vector2(3, 0) -- 새 List를 만들어 덮어써야 합니다. local list = {Vector2(3,0), Vector2(2,3)} target.CustomFootholdComponent.edgeLists[1] = list

[source] | examples [title] | CustomFootholdComponent [page] | apiReference/Components/CustomFootholdComponent [code] | local listlist = {{Vector2(0,2), Vector2(3,2)},{Vector2(4,5), Vector2(3,8)}} local target = _EntityService:GetEntityByPath(EntityPath) target.CustomFootholdComponent.edgeLists = listlist

[source] | examples [title] | ChatComponent [page] | apiReference/Components/ChatComponent [code] | Event Handler: [self] HandleChatEvent (ChatEvent event) { --------------- Native Event Sender Info ---------------- -- Sender: ChatComponent -- Space: Client --------------------------------------------------------- -- Parameters local Message = event.Message local SenderName = event.Sende

[source] | examples [title] | AIChaseComponent [page] | apiReference/Components/AIChaseComponent [code] | Method: [server only] void OnBeginPlay () { local aiChaseComponent = self.Entity.AIChaseComponent if aiChaseComponent == nil then return end aiChaseComponent.IsChaseNearPlayer = false local chatBallon = self.Entity.ChatBalloonComponent if chatBallon == nil then chatBallon = self.Enti

[source] | examples [title] | FootholdComponent [page] | apiReference/Components/FootholdComponent [code] | Method: [server] void GetNearstFootholdByPoint(Vector point, number distance) { local footholdComponent = self.Entity.CurrentMap.FootholdComponent if footholdComponent == nil then return end local foothold = footholdComponent:GetNearestFootholdByPoint(point, distance) if foothold == nil th

[source] | examples [title] | ClimbableComponent [page] | apiReference/Components/ClimbableComponent [code] | Method: [server] void ChangeBoxSize (Vector2 boxSize) { local entity = _EntityService:GetEntityByPath(EntityPath) entity.ClimbableComponent.BoxSize = boxSize } [client] void ChangeSpeedVector (Vector2 speedVector) { local entity = _EntityService:GetEntityByPath(EntityPath) entity.ClimbableCompo

[source] | examples [title] | ButtonComponent [page] | apiReference/Components/ButtonComponent [code] | Property: [None] boolean IsButtonDown = false [None] number RedVal = 0 [None] number TimerID = 0 [None] string MonsterRUID = "000000" [None] string OriginalRUID = "" Method: [client only] void OnBeginPlay () { self.OriginalRUID = self.Entity.SpriteGUIRendererComponent.ImageRUID } void Canc

[source] | examples [title] | AttackComponent [page] | apiReference/Components/AttackComponent [code] | Method: [server only] void AttackNormal () { local attackSize = Vector2(1,1) local playerController = self.Entity.PlayerControllerComponent if playerController ~= nil then local attackOffset = Vector2(0.5 * playerController.LookDirectionX, 0.5) self:Attack(attackSize, attackOffset, nil, Col

[source] | examples [title] | BackgroundComponent [page] | apiReference/Components/BackgroundComponent [code] | Method: [server only] void ChangeBackgroundExample ( ) { local background = self.Entity.BackgroundComponent background:ChangeBackgroundByTemplateRUID("794ad8421e2543d8a6d2c70307637450") background:ChangeBackgroundBySolidColor(Color.white) background:ChangeBackgroundByWebUrl("Http://WebUrl") }

[source] | examples [title] | SliderComponent [page] | apiReference/Components/SliderComponent [code] | Property: [None] Entity TextEntity = EntityPath Method: [client only] void OnBeginPlay() { local sliderComp = self.Entity.SliderComponent if not sliderComp then return end sliderComp.UseIntegerValue = true sliderComp.MaxValue = 100 sliderComp.MinValue = 0 sliderComp.Value = 0 self

[source] | examples [title] | PortalComponent [page] | apiReference/Components/PortalComponent [code] | Method: [client only] void OnBeginPlay () { -- 현재 맵의 모든 Entity를 순회하며 PortalComponent를 가진 Entity들의 EntityRef 저장 self._T.portalRefList = {} local function findAndAddPortal(parent) -- 자기 자신은 제외 if parent.PortalComponent ~= nil and parent ~= self.Entity then table.insert(self._T.portalRefList,

[source] | examples [title] | HitComponent [page] | apiReference/Components/HitComponent [code] | Property: [Sync] number Health = 1000 [None] number InitialHealth = 0 [None] Vector2 InitialBoxSize = Vector2(0,0) Method: [server only] void OnBeginPlay () { self.InitialHealth = self.Health self.InitialBoxSize = self.Entity.HitComponent.BoxSize:Clone() } Entity Event Handler: [server only]

[source] | examples [title] | HitComponent [page] | apiReference/Components/HitComponent [code] | Property: [None] number ImmuneCooldown = 1 [None] number LastHitTime = 0 Method: override boolean IsHitTarget() { local currentTime = _UtilLogic.ElapsedSeconds if self.LastHitTime + self.ImmuneCooldown < currentTime then self.LastHitTime = _UtilLogic.ElapsedSeconds return true end retur

[source] | examples [title] | DirectionSynchronizerComponent [page] | apiReference/Components/DirectionSynchronizerComponent [code] | Method: [server only] void OnBeginPlay() { local modelId = "Model Entry ID" local attachedEntity = _SpawnService:SpawnByModelId(modelId, "attachedEntity", Vector3.zero, self.Entity, "") attachedEntity:AddComponent("DirectionSynchronizerComponent") }

← → 방향키로 페이지 이동 · 숫자 입력 후 Enter로 점프