มอดูล:utilities/scribunto parameter key
- This มอดูล lacks a documentation subpage. Please create it.
- Useful links: root page • root page’s subpages • links • transclusions • testcases • sandbox
local match = string.match
local tonumber = tonumber
local trim = require("Module:string/php trim")
local type = type
return function(key)
if type(key) ~= "string" then
return key
end
key = trim(key)
if match(key, "^-?[1-9]%d*$") then
local num = tonumber(key)
return (
num <= 9007199254740991 and num >= -9007199254740991 or
key == "9007199254740992" or
key == "-9007199254740992"
) and num or key
elseif key == "0" then
return 0
end
return key
end