Mercurial > prosody-hg
comparison util/jsonpointer.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 |
| parents | 03e307952816 |
| children | b713da7527d2 |
comparison
equal
deleted
inserted
replaced
| 12780:2c0c1b18a02b | 12781:22066b02887f |
|---|---|
| 1 local m_type = math.type or function (n) | 1 local m_type = math.type; |
| 2 return n % 1 == 0 and n <= 9007199254740992 and n >= -9007199254740992 and "integer" or "float"; | |
| 3 end; | |
| 4 | 2 |
| 5 local function unescape_token(escaped_token) | 3 local function unescape_token(escaped_token) |
| 6 local unescaped = escaped_token:gsub("~1", "/"):gsub("~0", "~") | 4 local unescaped = escaped_token:gsub("~1", "/"):gsub("~0", "~") |
| 7 return unescaped | 5 return unescaped |
| 8 end | 6 end |
