Skip to content

Commit

Permalink
Tuesday 2024-11-26 21:58:21
Browse files Browse the repository at this point in the history
  • Loading branch information
jackokring committed Nov 26, 2024
1 parent 03752b6 commit 9733ed3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions lua/doris/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,9 @@ end
---preferred date and time format string
---for use in filenames and sortables
---with no conversion or escape needed
_G.datetime = "%Y-%m-%d.%a.%H:%M:%S"
---UTC preferred
---@type string
_G.datetime = "!%Y-%m-%d.%a.%H:%M:%S"
---evaluate source code from a string
---this invert quote(code) and is useful
---with anonymous functions
Expand Down Expand Up @@ -628,11 +630,12 @@ end

---to number with default C numeric locale
---@param str string
---@param base? integer
---@return number?
_G.val = function(str)
_G.val = function(str, base)
local l = os.setlocale()
os.setlocale("C", "numeric")
local s = tonumber(str)
local s = tonumber(str, base or 10)
os.setlocale(l, "numeric")
return s
end
Expand Down
2 changes: 1 addition & 1 deletion lua/doris/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ end
---@param cmd string
---@return boolean
os.has = function(cmd)
return os.execute("which " .. cmd) == 0
return os.execute() == true and os.execute("which " .. cmd) == true
end

nv.untrack(os)
Expand Down

0 comments on commit 9733ed3

Please sign in to comment.