Jump to content

Module:Sandbox/Gnosygnu

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 68.192.174.14 (talk) at 04:53, 27 December 2015 (cyrillic case comparison check). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
--This Module is for Lua experimentation. No other pages refer to it.

local p = {}

function p.gsub_string(frame)
    local arg_1 = frame.args[1]
    local arg_2 = frame.args[2]
    local arg_3 = frame.args[3]
    local rv = ""
    rv = mw.ustring.gsub(arg_1, arg_2, arg_3)
    return rv
end

function p.wikibase_novalue(frame)
  local item = mw.wikibase.getEntityObject();
  local prop = item.claims[frame.args[2]];
  local rv = '';
  for _, statement in pairs( prop ) do
    local dv = statement.mainsnak.datavalue;
    if (dv == nil) then
      rv = rv .. ';nil';
    else
      rv = rv .. ';val';
    end
  end
  return rv
end

function p.wikibase_resolvePropertyId(frame)
  return mw.wikibase.resolvePropertyId(frame.args[1])
end

function p.scrib_lang_ru_s(frame)
      local title = 'Ибн-Яиш, Барух бен-Исаак';
      local rv = 'result:';
      if (title >= 'Иа' and title < 'Иб') then
         rv = rv .. '0 ';
      end
      if (title >= 'Иб' and title < 'Ибнэ') then
         rv = rv .. '1 ';
      end
      return rv;
end

return p