Software /
code /
prosody
Comparison
util/startup.lua @ 12782:8815d3090928
util.mathcompat: Module to ease reuse of math.type()
Mostly to ensure it is available during tests, as util.startup is not
invoked there
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 20 Oct 2022 16:50:12 +0200 |
parent | 12781:22066b02887f |
child | 12864:9f9633364044 |
comparison
equal
deleted
inserted
replaced
12781:22066b02887f | 12782:8815d3090928 |
---|---|
278 startup.detect_installed(); | 278 startup.detect_installed(); |
279 _G.prosody = prosody; | 279 _G.prosody = prosody; |
280 | 280 |
281 -- COMPAT Lua < 5.3 | 281 -- COMPAT Lua < 5.3 |
282 if not math.type then | 282 if not math.type then |
283 -- luacheck: ignore 122/math | 283 require "util.mathcompat" |
284 function math.type(n) | |
285 if type(n) == "number" then | |
286 if n % 1 == 0 and (n + 1 ~= n and n - 1 ~= n) then | |
287 return "integer" | |
288 else | |
289 return "float" | |
290 end | |
291 end | |
292 end | |
293 end | 284 end |
294 end | 285 end |
295 | 286 |
296 function startup.setup_datadir() | 287 function startup.setup_datadir() |
297 prosody.paths.data = config.get("*", "data_path") or CFG_DATADIR or "data"; | 288 prosody.paths.data = config.get("*", "data_path") or CFG_DATADIR or "data"; |