view util/mathcompat.lua @ 13610:ff0f4d1f16c8

prosodyctl: Add lua_paths command to print the LUA_PATH and LUA_CPATH used This can be useful to run scripts and stuff with access to the same Lua paths as Prosody uses.
author Matthew Wild <mwild1@gmail.com>
date Wed, 08 Jan 2025 20:37:35 +0000
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