“模块:TWRSideNavBox”的版本间的差异
跳到导航
跳到搜索
(创建页面,内容为“local p = {} itemString = "|-\n|[[File:{{{1}}}|50px|link={{FULLPAGENAME}}#{{{2}}}]]\n" function p.assemblyFixedNavBox( frame ) local returnString = "" for…”) |
(没有差异)
|
2022年1月2日 (日) 18:11的版本
Lua错误 在第8行:attempt to index local 'v' (a function value)
local p = {} itemString = "|-\n|[[File:{{{1}}}|50px|link={{FULLPAGENAME}}#{{{2}}}]]\n" function p.assemblyFixedNavBox( frame ) local returnString = "" for k, v in pairs(frame) do splitPoint = v:find("::") -- Format of each element: "<File Name>::<Anchor>" -- with no spaces to both sides of the backslash if splitPoint ~= nil and splitPoint > 1 then name1 = v:sub(1, splitPoint - 1) name2 = v:sub(splitPoint + 2) if name1:find("%.%w+$") ~= nil then segment = itemString:gsub("{{{1}}}", name1) else -- If no file extension is found, assumes PNG by default segment = itemString:gsub("{{{1}}}", name1 .. ".png") end segment = segment:gsub("{{{2}}}", name2) returnString = returnString .. segment end end return "{|\n" .. returnString .. "|}" end return p