Lua runner with rich builtin stdlib
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
a/lua/stubs/os.lua

23 lines
1.1 KiB

---@meta
---@diagnostic disable: missing-return
-- Type stubs for the `a` additions to the sandboxed `os` table.
--
-- The sandbox trims `os` to its time-related functions — os.time, os.clock,
-- os.date, os.difftime, os.getenv — plus the two additions below. The
-- system-access functions (os.execute, os.exit, os.remove, os.rename,
-- os.tmpname, os.setlocale) do NOT exist at runtime; lua-language-server
-- cannot hide individual fields, so it still suggests them — do not use them.
-- Reference: docs/os.md
---Current time as a Unix timestamp in seconds, as a float with sub-second
---precision (wall clock — may jump if the system clock is adjusted). Use the
---difference of two readings for interval timing.
---@return number timestamp
function os.microtime() end
---Async sleep: pause for `seconds` (a float, so 0.1 is 100 ms) by suspending
---on the runtime instead of blocking the thread — sibling task.join tasks
---keep running. Does not actually wait inside self-driven coroutines
---(coroutine.wrap/resume); run those through task.join instead.
---@param seconds number non-negative finite
function os.sleep(seconds) end