view util/mathcompat.lua @ 14173:44e5c73e6fa3 13.0

util.dataforms: Don't treat invalid jid-multi as missing If all the submitted JIDs were invalid, #results would be 0 and the field would be treated as absent rather than invalid.
author Matthew Wild <mwild1@gmail.com>
date Mon, 25 May 2026 13:14:53 +0100
parents 8815d3090928
children
line wrap: on
line source

if not math.type then

	local function math_type(t)
		if type(t) == "number" then
			if t % 1 == 0 and t ~= t + 1 and t ~= t - 1 then
				return "integer"
			else
				return "float"
			end
		end
	end
	_G.math.type = math_type
end