← 목록

mLua · 문서 코드 예제

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

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- startIndex 지정 local origin = "Who writes these notes and uses our paper?" local pattern = "\\b\\w+es\\b" local regex = Regex(pattern) local firstMatch = regex:Match(origin) local matches = regex:Matches(origin, firstMatch.Index + firstMatch.Length) log(#matches) -- 2 for i, match in

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- 일반 local origin = "This is text with far too much white space." local pattern = "\\s+" local regex = Regex(pattern) local result = regex:Replace(origin, " ") log(result) -- "This is text with far too much white space."

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | local origin = "This is text with far too much white space." local pattern = "\\s+" local regex = Regex(pattern) local result = regex:Replace(origin, " ", 4) log(result) -- "This is text with far too much white space."

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- 최대 개수와 시작 위치 설정 local origin = "1 3 5 7 9 h e l l o w o r l d" local pattern = "\\s+" local regex = Regex(pattern) local result = regex:Replace(origin, "", 4, 11) log(result) -- "1 3 5 7 9 hello w o r l d"

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | local origin = "letter alphabetical missing lack release penchant slack acryllic laundry cease" local pattern = "\\w+ " local regex = Regex(pattern, RegexOption.IgnorePatternWhitespace) ---@param match RegexMatch ---@return string local function evaluator(match) return match.Text.."("..tost

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | local origin = "letter alphabetical missing lack release penchant slack acryllic laundry cease" local pattern = "\\w+ " local regex = Regex(pattern, RegexOption.IgnorePatternWhitespace) ---@param match RegexMatch ---@return string local function evaluator(match) return match.Text.."("..

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | local origin = "letter alphabetical missing lack release penchant slack acryllic laundry cease" local pattern = "\\w+ " local regex = Regex(pattern, RegexOption.IgnorePatternWhitespace) ---@param match RegexMatch ---@return string local function evaluator(match) return match.Text.."("..to

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | local origin = "plum-bear-pear" local pattern = "-" local regex = Regex(pattern) local texts = regex:Split(origin) log(#texts) -- 3 for i, text in pairs(texts) do log(text) end -- (결과) -- plum -- bear -- pear

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- count 지정 local origin = "apple-apricot-plum-pear-banana" local pattern = "-" local regex = Regex(pattern) local texts = regex:Split(origin, 4) log(#texts) -- 4 for i, text in pairs(texts) do log(text) end -- (결과) -- apple -- apricot -- plum -- pear-banana

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | local origin = "apple-apricot-plum-pear-banana" local pattern = "-" local regex = Regex(pattern) local texts = regex:Split(origin, 4, 7) log(#texts) -- 4 for i, text in pairs(texts) do log(text) end -- (결과) -- apple-apricot -- plum -- pear -- banana

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- IgnoreCase 옵션 설정하지 않음 local pattern = "\\bthe\\w*\\b" local input = "The man then told them about that event." local noOptionRegex = Regex(pattern) local matches = noOptionRegex:Matches(input) log(#matches) -- 2 -- IgnoreCase 옵션 설정함 local optionRegex = Regex(pattern, RegexOption.IgnoreCase)

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- IgnorePatternWhitespace 옵션 설정하지 않음 local pattern = "\\b \\(? ( (?>\\w+) ,?\\s? )+ [\\.!?] \\)? # Matches an entire sentence." local input = "This is the first sentence. Is it the beginning of a literary masterpiece? I think not. Instead, it is a nonsensical paragraph." local noOptionRegex = Reg

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- RightToLeft 옵션 설정하지 않음 local pattern = "\\bb\\w+\\s" local input = "build11 band22 tab" local noOptionRegex = Regex(pattern) local matches = noOptionRegex:Matches(input) log(noOptionRegex.IsRightToLeft) -- false for i, match in pairs(matches) do log(match.Text) end -- (결과) -- build1

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- ExplicitCapture 옵션 설정하지 않음 local pattern = "^(?<first>\\d{3})-(\\d{4})-(\\d{4})-(\\d{4})-(\\d{4})-(\\d{4})-(\\d{4})-(?<last>\\d{3})$" local input = "010-1111-2222-3333-4444-5555-6666-777" local noOptionRegex = Regex(pattern) local match = noOptionRegex:Match(input) ---@type table<any, RegexGr

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- Multiline 옵션 사용하지 않음 local pattern = "^(?<Name>\\w+)\\s(?<Number>\\d+)$" local input = "Joe 164\nSam 208\nAllison 211\nGwen 171\n" local noOptionRegex = Regex(pattern) local matches = noOptionRegex:Matches(input) log(#matches) -- 0 for i, match in pairs(matches) do ---@type ta

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | -- Singleline 옵션 사용하지 않음 local pattern = "^.+" local input = "This is one line and\nthis is the second." local noOptionRegex = Regex(pattern) local match = noOptionRegex:Match(input) log(match.Text) -- "This is one line and" -- Singleline 옵션 사용함 local optionRegex = Regex(pattern, Reg

[source] | guide_examples [title] | 정규식 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1041 [code] | local regex = Regex("line\\w+", RegexOption.Singleline | RegexOption.RightToLeft | RegexOption.IgnoreCase) local matches = regex:Matches("lineFirst \n LineSecond \n LineLast") for i, match in pairs(matches) do log(match.Text) end -- (결과) -- LineLast -- LineSecond -- lineFirst

[source] | guide_examples [title] | 중복 컴포넌트 수정하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1049 [code] | Method: void Open() { log("Door Open") } void Close () { log("Door Close") }

[source] | guide_examples [title] | 중복 컴포넌트 수정하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1049 [code] | Property: [None] Entity Door1 = /maps/map01/Door1 [None] Entity Door2 = /maps/map01/Door2 Method: void OpenAll() { self.Door1.DoorComponent:Open() -- Automatic Sliding Door Open Self.Door2.DoorComponent:Open() -- Revolving Door Open }

[source] | guide_examples [title] | 중복 컴포넌트 수정하기 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1049 [code] | Property: [None] -- AutomaticSlidingDoorComponent/RevolvingDoorComponent 모두 존재하는 엔티티 Entity Door = /maps/map01/TestEntity Method: void OpenAll() { -- AutomaticSlidingDoorComponent/RevolvingDoorComponent 둘 중 어떤 Open()을 할지 모호함 self.Door.DoorComponent:Open() }

[source] | guide_examples [title] | 메이플스토리 월드 루아 문법 확장 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1071 [code] | local oddNumbers = {} for i = 1, 10 do if i % 2 == 0 then continue -- 짝수는 이후 작업을 하지 않음 end print("odd number : ", i) table.insert(oddNumbers, i) end -- Output : -- odd number : 1 -- odd number : 3 -- odd number : 5 -- odd number : 7 -- odd number : 9

[source] | guide_examples [title] | 메이플스토리 월드 루아 문법 확장 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1071 [code] | self.Entity.TransformComponent.Position.x += 0.1 -- Position의 x값을 0.1 증가시킴 local num = 1 num += 2 -- num에 2를 더한 값을 할당함 print(num) -- Output : -- 3

[source] | guide_examples [title] | 메이플스토리 월드 루아 문법 확장 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1071 [code] | self.Entity.TransformComponent.Position.x -= 0.1 -- Position의 x값을 0.1 감소시킴 local num = 1 num -= 2 -- num에 2를 뺀 값을 할당함 print(num) -- Output : -- -1

[source] | guide_examples [title] | 메이플스토리 월드 루아 문법 확장 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1071 [code] | local num = 2 num *= 3 -- num에 3을 곱한 값을 할당함 print(num) -- Output : -- 6

[source] | guide_examples [title] | 메이플스토리 월드 루아 문법 확장 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1071 [code] | local num = 5 num /= 2 -- num을 2로 나눈 값을 num에 할당함 print(num) -- Output : -- 2.5

[source] | guide_examples [title] | 메이플스토리 월드 루아 문법 확장 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1071 [code] | local num = 5 num //= 2 -- num을 2로 나눈 몫을 num에 할당함 print(num) -- Output : -- 2

[source] | guide_examples [title] | 메이플스토리 월드 루아 문법 확장 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1071 [code] | local num = 5 num %= 2 -- num을 2로 나눈 나머지를 num에 할당함 print(num) -- Output : -- 1

[source] | guide_examples [title] | 메이플스토리 월드 루아 문법 확장 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1071 [code] | local num = 5 num ^= 2 -- num의 제곱을 num에 할당함 print(num) -- Output : -- 25.0

[source] | guide_examples [title] | 메이플스토리 월드 루아 문법 확장 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1071 [code] | local str = 'Hello, ' str ..= 'MapleStory ' str ..= 'World!' print(str) -- Output : -- Hello, MapleStory World!

[source] | guide_examples [title] | 메이플스토리 월드 루아 문법 확장 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=1071 [code] | local num = 2 -- 0b0010 -- 0b는 해당 숫자가 이진수임을 나타내는 표기법 -- num의 이진수를 왼쪽으로 1만큼 이동시킴 num <<= 1 -- 0b0100 print(num) -- Output : -- 4

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