diff --git a/lua/doris/module.lua b/lua/doris/module.lua index 699160a..4233c5a 100644 --- a/lua/doris/module.lua +++ b/lua/doris/module.lua @@ -631,11 +631,11 @@ end ---to number with default C numeric locale ---@param str string ---@param base? integer ----@return number? +---@return number _G.val = function(str, base) local l = os.setlocale() os.setlocale("C", "numeric") - local s = tonumber(str, base or 10) + local s = tonumber(str, base or 10) or 0 os.setlocale(l, "numeric") return s end