문서 편집 권한이 없습니다. 다음 이유를 확인해주세요: 요청한 명령을 실행할 권한이 없습니다. 문서의 원본을 보거나 복사할 수 있습니다. p = {} function shallow_copy(t) local t2 = {} for k,v in pairs(t) do t2[k] = v end return t2 end function p.parse(str) local ctx = {} ctx.indent = -2 ctx.depth = -2 ctx.path = {} ctx.obj = {} result = {} for line in str:gmatch("[^\r\n]+") do indent, bar, text, colon = line:match("^(%s*)(-?)%s*([^:]+)(:?)%s*$") if ctx.indent > indent:len() then if indent:len() < ctx.depth then result = {[ctx.path[#ctx.path]] = result} ctx.depth = ctx.depth - 2 else result[ctx.path[#ctx.path]] = ctx.obj ctx.depth = indent:len() ctx.obj = {} end table.remove(ctx.path) end if colon ~= "" then table.insert(ctx.path, text) elseif bar ~= "" then table.insert(ctx.obj, text) end ctx.indent = indent:len() mw.logObject(ctx) end for i = #ctx.path, 1, -1 do result[ctx.path[i]] = ctx.obj ctx.obj = {} table.remove(ctx.path) mw.logObject(ctx) end return result end return p 이 문서에서 사용한 틀: 모듈:Temflake/설명문서 (원본 보기) 모듈:Temflake 문서로 돌아갑니다.