אונטערשייד צווישן ווערסיעס פון "יחידה:Lexicon"

103 בייטן צוגעלייגט ,  פֿאַר 2 יאָר
קיין רעדאגירונג באמערקונג
אין תקציר עריכה
אין תקציר עריכה
צייכן: מאנועל צוריקשטעל
 
(8 צווישנדיגע ווערסיעס פונעם זעלבן באַניצער נישט געוויזן)
שורה 1: שורה 1:
local p = {}
local p = {}


--[[
local function stripToNil(text)
local function stripToNil(text)
-- If text is a string, return its trimmed content, or nil if empty.
-- If text is a string, return its trimmed content, or nil if empty.
שורה 10: שורה 9:
return text
return text
end
end
]]--


function p.fetch(frame)
function p.fetch(frame)
שורה 17: שורה 15:
local args = getArgs(frame)
local args = getArgs(frame)
local data = mw.loadData('יחידה:Lexicon/Data')
local data = mw.loadData('יחידה:Lexicon/Data')
local word = args[1]
local word = stripToNil(args[1])
return data.words[word]
local ret = data[word]
if not ret then
if args[2] then
ret = args[2]
else
ret = args[1]
    end
end
return ret
end
end


return p
return p