diff options
author | Michael Martin <flrgh@protonmail.com> | 2021-12-21 18:12:20 -0800 |
---|---|---|
committer | Michael Martin <flrgh@protonmail.com> | 2021-12-21 18:12:20 -0800 |
commit | 17da081e1abf752b79eab76067c27f738fccb927 (patch) | |
tree | 7e67428de22b07885403c61e748d8880b4b9eb36 /meta/3rd/OpenResty/library/jit.lua | |
parent | 20912f9febfa3c6cea4c11379425971a5b4de7bf (diff) | |
download | lua-language-server-17da081e1abf752b79eab76067c27f738fccb927.zip |
chore: add more luajit annotations from https://github.com/openresty/luajit2
Diffstat (limited to 'meta/3rd/OpenResty/library/jit.lua')
-rw-r--r-- | meta/3rd/OpenResty/library/jit.lua | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/meta/3rd/OpenResty/library/jit.lua b/meta/3rd/OpenResty/library/jit.lua new file mode 100644 index 00000000..1adb40fa --- /dev/null +++ b/meta/3rd/OpenResty/library/jit.lua @@ -0,0 +1,32 @@ +---@meta + + +--- Returns (and optionally sets) the current PRNG state (an array of 8 Lua +--- numbers with 32-bit integer values) currently used by the JIT compiler. +--- +--- When the `state` argument is non-nil, it is expected to be an array of up to 8 +--- unsigned Lua numbers, each with value less than 2\*\*32-1. This will set the +--- current PRNG state and return the state that was overridden. +--- +--- **Note:** For backward compatibility, `state` argument can also be an unsigned +--- Lua number less than 2\*\*32-1. +--- +--- **Note:** When the `state` argument is an array and less than 8 numbers, or the +--- `state` is a number, the remaining positions are filled with zeros. +--- +--- Usage: +--- +--- ```lua +--- local state = jit.prngstate() +--- local oldstate = jit.prngstate{ a, b, c, ... } +--- +--- jit.prngstate(32) -- {32, 0, 0, 0, 0, 0, 0, 0} +--- jit.prngstate{432, 23, 50} -- {432, 23, 50, 0, 0, 0, 0, 0} +--- ``` +--- +--- **Note:** This API has no effect if LuaJIT is compiled with +--- `-DLUAJIT_DISABLE_JIT`, and will return a table with all `0`. +--- +---@param state? integer[] +---@return integer[] state +function jit.prngstate(state) end |