view util/mathcompat.lua @ 13929:203a0b5ade55

util.startup: Add Lua 5.5 GC defaults ~$ lua5.5 Lua 5.5.0 Copyright (C) 1994-2025 Lua.org, PUC-Rio > collectgarbage("param", "minormul") 20 > collectgarbage("param", "majorminor") 50 > collectgarbage("param", "minormajor") 68
author Kim Alvefur <zash@zash.se>
date Wed, 06 Aug 2025 16:48:35 +0200
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