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.
31 lines
1.5 KiB
31 lines
1.5 KiB
---@meta
|
|
---@diagnostic disable: missing-return
|
|
-- Type stubs for the Luna 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 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
|
|
|
|
---Command-line arguments passed to the script: everything after the script
|
|
---path on the `luna` command line (or after a literal `--`), including
|
|
---arguments given directly to an executable `#!/usr/bin/env luna` script.
|
|
---Returns a fresh array each call; empty in the REPL. Arguments are raw byte
|
|
---strings (no UTF-8 conversion).
|
|
---@return string[] args
|
|
function os.args() end
|
|
|
|
---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
|
|
|