Module:Sandbox/BlaueBlüte/Wikibase/lexFormSimple

local m = {}

function m.getFormHavingFeature(frame) if frame == nil or frame.args == nil or frame.args.lexemeId == nil or frame.args.lexemeId == '' then return " Please specify 'lexemeId' parameter. " end local lexemeId = frame.args.lexemeId local requestedFeatureId = frame.args.featureId local requestedLanguageCode = frame.args.languageCode local lexeme = mw.wikibase.getEntity( lexemeId ) local forms = lexeme.forms local s = "[no form having feature " .. requestedFeatureId .. "]"	for i, form in pairs(forms) do		local formFeatureIds = form.grammaticalFeatures for _, featureId in pairs(formFeatureIds) do			if featureId == requestedFeatureId then local representations = form.representations for _, representation in pairs(representations) do					if not requestedLanguageCode or representation.language == requestedLanguageCode then s = representation.value end end end end end return s end

return m