view util/mathcompat.lua @ 14178:af87d31dcae4 13.0

util.crypto: Ensure signing parameter is a string lua_tostring() returns NULL if the specified value is missing or can't become a string. luaL_checkstring() will raise an error. We prefer the latter behaviour, otherwise we end up passing NULL to OpenSSL.
author Matthew Wild <mwild1@gmail.com>
date Mon, 25 May 2026 14:51:15 +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