[source] | guide_examples [title] | 메이플스토리 월드 루아 구문 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=944 [code] | local secondsElapsed = 0 local timeout = 5 while true do log(secondsElapsed.."초") wait(1) secondsElapsed = secondsElapsed + 1 if secondsElapsed == timeout then break end end log("5초가 지났습니다. 다음 맵으로 이동합니다.") --[[결과: 0초 1초 2초 3초 4초 5초가 지났습니다. 다음 맵으로 이동합니다. ]]
[source] | guide_examples [title] | 인벤토리 UI 스크립트 작성하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=946 [code] | Property: [None] Entity itemUI = nil [None] Entity scrollView = nil [None] SyncTable<string, Entity> SlotItems [None] string inventoryBtnPath = "/ui/DefaultGroup/RPGButtons/btn_inventory" Method: [client only] void OnBeginPlay { self.itemUI =_EntityService:GetEntityByPath(self.Entity.Path .
[source] | guide_examples [title] | 인벤토리 UI 스크립트 작성하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=946 [code] | Property: [None] number ItemIndex = 0 [None] number ItemCount = 0 Method: void SetData(number itemIndex, number itemCount) { -- 슬롯에 아이템 정보를 설정함 self.ItemIndex = itemIndex self.ItemCount = itemCount local imageEntity = self.Entity:GetChildByName("img_slot") local iconRUID = _
[source] | guide_examples [title] | 아이템 스크립트 작성하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=947 [code] | Property: [Sync] number ItemIndex = 0 [Sync] number DropTweenTime = 0.8 Method: void InitItem(number itemIndex) { self.ItemIndex = itemIndex local sprite = self.Entity.SpriteRendererComponent local itemDataSet = _DataService:GetTable("UserItemDataSet") local ruid = itemDataSet:GetR
[source] | guide_examples [title] | 로컬라이징의 이해 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=951 [code] | _LocalizationService:GetText("UI_TEXT_NPC_Stan") -- 스탄 _LocalizationService.LocalTranslator:GetText("UI_TEXT_NPC_Stan") -- 스탄
[source] | guide_examples [title] | 로컬라이징의 이해 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=951 [code] | local enTranslator = _LocalizationService:GetTranslatorForLocale("en") enTranslator:GetText("UI_TEXT_NPC_Stan") -- Stan
[source] | guide_examples [title] | 포맷에 맞게 로컬라이징하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=968 [code] | [client only][self] HandleTriggerEnterEvent(TriggerEnterEvent event) { -- Parameters local TriggerBodyEntity = event.TriggerBodyEntity -------------------------------------------------------- local npcName = TriggerBodyEntity.NameTagComponent.Name local translateText = _Localizat
[source] | guide_examples [title] | 포맷에 맞게 로컬라이징하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=968 [code] | [client only][self] HandleTriggerEnterEvent(TriggerEnterEvent event) { -- Parameters local TriggerBodyEntity = event.TriggerBodyEntity -------------------------------------------------------- local npcName = TriggerBodyEntity.NameTagComponent.Name local localeId = _LocalizationSe
[source] | guide_examples [title] | 포맷에 맞게 로컬라이징하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=968 [code] | _LocalizationService:SmartFormat("I have {0:plural:an apple|{} apples}.", 2) -- I have 2 apples.
[source] | guide_examples [title] | 포맷에 맞게 로컬라이징하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=968 [code] | -- 1) 언어 설정 영어 : formatter name에 띄어쓰기가 포함된 경우 log(_LocalizationService:SmartFormat("I have {0: plural:an apple|{} apples}.", 2))
[source] | guide_examples [title] | 포맷에 맞게 로컬라이징하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=968 [code] | -- 2) formatter name 자체가 틀린 경우 (예: hpp를 hp로 잘못 작성) log(_LocalizationService:SmartFormat("나는 {0}{0:hp:을|를} 만났다.", "스탄"))
[source] | guide_examples [title] | 포맷에 맞게 로컬라이징하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=968 [code] | log(_LocalizationService:SmartFormat("I have {0:plural:an apple|{} apples}.", 2))
[source] | guide_examples [title] | 포맷에 맞게 로컬라이징하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=968 [code] | log(_LocalizationService:SmartFormat("나는 {0}{0:hpp:을|를} 만났다.", "스탄"))
[source] | guide_examples [title] | 포맷에 맞게 로컬라이징하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=968 [code] | -- 언어 설정 한국어 : plural 사용 log(_LocalizationService:SmartFormat("아이템 {0:plural:한 |여러 }개를 획득했다.", 1)) -- 결과 : 원문 출력 (한국어 plural은 1개의 formatter argument만 받기 때문)
[source] | guide_examples [title] | 포맷에 맞게 로컬라이징하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=968 [code] | -- 언어 설정 영어 : formatter argument의 개수가 필요한 개수와 다른 경우 log(_LocalizationService:SmartFormat("I have {0:plural:one}.", 1)) -- 결과 : 원문 출력 (영어 plural은 2개의 formatter argument를 받기 때문) -- 언어 설정 영어 : formatter argument를 공백으로 둘 때 log(_LocalizationService:SmartFormat("I have {0:plural:|}.", 1)) -- 결과 : 정상 출력 (
[source] | guide_examples [title] | 포맷에 맞게 로컬라이징하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=968 [code] | -- 언어 설정 영어 : format argument의 개수가 argument hole의 최대 인덱스 +1보다 많음 log(_LocalizationService:SmartFormat("I have {0:plural:an apple|{} apples} and {1:plural:a cherry|{} cherries}.", 2, 1, 1)) -- 결과 : 정상 출력 -- 언어 설정 영어 : format argument의 개수가 argument hole의 최대 인덱스보다 적음 log(_LocalizationService:SmartForm
[source] | guide_examples [title] | 월드 인스턴스 통신 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=999 [code] | -- WorldInstanceSharedMemory를 얻어옵니다. local getMemResultCode, mem = _WorldInstanceService:GetSharedMemory("MemoryName") -- 공유 변수 var1을 생성합니다. local createVarResult = mem:CreateVariableAndWait("var1", "value1") log (createVarResult.Info.Name) -- var1 log (createVarResult.Info.Value) --
[source] | guide_examples [title] | 월드 인스턴스 통신 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=999 [code] | -- 공유 변수 var1의 참조를 해제합니다. local releaseVarResult = mem:ReleaseVariableAndWait("var1") -- WorldInstanceSharedMemory 내 모든 공유 변수의 참조를 해제합니다. local releaseMemResultCode = _WorldInstanceService:ReleaseSharedMemoryAndWait("MemoryName")
[source] | guide_examples [title] | 월드 인스턴스 통신 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=999 [code] | local code, mem = _WorldInstanceService:GetSharedMemory("MemoryName") local nameValues = { ["b_var1"] = "b_value1", ["b_var2"] = "b_value2", ["b_var3"] = "b_value3" } local results = mem:BatchCreateVariableAndWait(nameValues) log (results["b_var1"].Info.Value) -- b_value1 log (results["b_
[source] | guide_examples [title] | 월드 인스턴스 통신 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=999 [code] | local code, mem = _WorldInstanceService:GetSharedMemory("MemoryName") -- current.Info.ETag 에는 최신 ETag가 담겨 있습니다. local current = mem:GetVariableAndWait("varname") -- keyInfo에 최신 ETag를 담아 보내야만 공유 변수가 수정됩니다. 다른 값을 담으면 수정되지 않습니다. 단, 빈 문자열이나 nil을 담으면 무조건 공유 변수가 수정됩니다. local keyInfo = SharedVariable
[source] | guide_examples [title] | 월드 인스턴스 통신 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=999 [code] | -- MyWorldInstanceEvent 이벤트를 모든 월드 인스턴스에 전송합니다. local evt = MyWorldInstanceEvent() local code = _WorldInstanceService:RequestSendEventToAllWorldInstancesAndWait(evt) if code ~= SendEventRequestResultCode.OK then error ("_WorldInstanceService:RequestSendEventToAllWorldInstancesAndWait failed."
[source] | guide_examples [title] | 월드 인스턴스 통신 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=999 [code] | Event Handler: [service: WorldInstanceService] HandleMyWorldInstanceEvent(MyWorldInstanceEvent event ) { log ("Receive MyWorldInstanceEvent.") }
[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- "word" 를 찾는 정규식 객체 local regex = Regex("word")
[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- 대/소문자를 구분하지 않고 "word" 를 검색 local regex = Regex("word", RegexOption.IgnoreCase)
[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- 일반 local pattern = "^[A-Z0-9]\\d{2}[A-Z0-9](-\\d{3}){2}[A-Z0-9]$" local regex = Regex(pattern, RegexOption.IgnoreCase) log(regex:IsMatch("1298-673-4192")) -- true log(regex:IsMatch("A08Z-931-468a")) -- true log(regex:IsMatch("_A90-123-129X")) -- false log(regex:IsMatch("12345-KKA-
[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- startIndex 지정 local pattern = "[a-zA-Z0-9]\\d{2}[a-zA-Z0-9](-\\d{3}){2}[A-Za-z0-9]$" local regex = Regex(pattern) log(regex:IsMatch("Part Number: 1298-673-4192", 10)) -- true log(regex:IsMatch("Part Number: 1298-673-4192", 15)) -- false
[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | local input = "One car red car blue car" local pattern = "(\\w+)\\s+(car)" local regex = Regex(pattern, RegexOption.IgnoreCase) local match = regex:Match(input) while match.Success do log(match.Text) match = match:NextMatch() end -- (결과) -- One car -- red car -- blue car
[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- startIndex 지정 local origin = "123456789" local pattern = "\\d" local regex = Regex(pattern) log(regex:Match(origin, 1).Text) -- 1 log(regex:Match(origin, 3).Text) -- 3 log(regex:Match(origin, 5).Text) -- 5
[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- startIndex와 길이 지정 local origin = "123456789" local pattern = "\\d+" local regex = Regex(pattern) log(regex:Match(origin, 1, 5).Text) -- 12345 log(regex:Match(origin, 3, 3).Text) -- 345 log(regex:Match(origin, 5, 1).Text) -- 5
[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | local origin = "Who writes these notes and uses our paper?" local pattern = "\\b\\w+es\\b" local regex = Regex(pattern) local matches = regex:Matches(origin) log(#matches) -- 3 for i, match in pairs(matches) do log(match.Text) end -- (결과) -- writes -- notes -- uses