check.lua - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/check.lua
blob: 239931b8422e7518048048ee9382b8ea1b4f17f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

local M = {}
local floor = math.floor
local type = type
local function is_integer(x)
 if type(x) == 'number' then
 return (floor(x) == x)
 else
 return false
 end
end
local function is_real(x)
 return type(x) == 'number'
end
function M.integer(x)
 if not is_integer(x) then error('integer expected', 2) end
end
function M.number(x)
 if not is_real(x) then error('number expected', 2) end
end
M.is_integer = is_integer
M.is_real = is_real
return M
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月11日 01:02:14 +0000

AltStyle によって変換されたページ (->オリジナル) /