aboutsummaryrefslogtreecommitdiffstats
path: root/teal-src/prosody/util/mathcompat.tl
blob: 1e3f9bab6dda6f8592dbac0298fa2b58b8cac5c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if not math.type then
	local enum number_subtype
		"float" "integer"
	end
	local function math_type(t:any) : number_subtype
		if t is 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