Software /
code /
prosody
Comparison
util/serialization.lua @ 12781:22066b02887f
util.startup: Provide a common Lua 5.3+ math.type() for Lua 5.2
Code deduplication
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 19 Oct 2022 16:25:05 +0200 |
parent | 11093:ec14d4fce855 |
child | 12782:8815d3090928 |
comparison
equal
deleted
inserted
replaced
12780:2c0c1b18a02b | 12781:22066b02887f |
---|---|
20 | 20 |
21 local pcall = pcall; | 21 local pcall = pcall; |
22 local envload = require"util.envload".envload; | 22 local envload = require"util.envload".envload; |
23 | 23 |
24 local pos_inf, neg_inf = math.huge, -math.huge; | 24 local pos_inf, neg_inf = math.huge, -math.huge; |
25 local m_type = math.type or function (n) | 25 local m_type = math.type; |
26 return n % 1 == 0 and n <= 9007199254740992 and n >= -9007199254740992 and "integer" or "float"; | |
27 end; | |
28 | 26 |
29 local function rawpairs(t) | 27 local function rawpairs(t) |
30 return next, t, nil; | 28 return next, t, nil; |
31 end | 29 end |
32 | 30 |