Module:SMW Utils

From Brighter Shores Wiki
Revision as of 15:45, 24 March 2024 by Gau Cho (talk | contribs) (Created page with "-- Helpers functions for SMW local p = {} --[[ Returns a boolean, whether the provided string is a valid subobject name Invalid subobject names are: '', '0', and any string with a '.' in the first 5 characters --]] function p.valid_subobject_name(arg) if arg == '0' or arg == '' then return false end if mw.ustring.find(mw.ustring.sub(arg, 1, 5), '.', 1, true) then return false end return true end return p")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Module documentation
This documentation is transcluded from Module:SMW Utils/doc. [edit] [history] [purge]
This module does not have any documentation. Please consider adding documentation at Module:SMW Utils/doc. [edit]
Module:SMW Utils is required by Module:Infobox.

-- Helpers functions for SMW

local p = {}

--[[
	Returns a boolean, whether the provided string is a valid subobject name
	Invalid subobject names are: '', '0', and any string with a '.' in the first 5 characters
--]]
function p.valid_subobject_name(arg)
	if arg == '0' or arg == '' then
		return false
	end
	if mw.ustring.find(mw.ustring.sub(arg, 1, 5), '.', 1, true) then
		return false
	end
	return true
end

return p