File

util/mathcompat.lua @ 13460:a688947fab1e

mod_bosh: Set base_type on session This fixes a traceback with mod_saslauth. Ideally we move this to util.session at some point, though.
author Matthew Wild <mwild1@gmail.com>
date Sun, 17 Mar 2024 10:10:24 +0000
parent 12782:8815d3090928
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