diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/libs/lua/bit32.lni | 136 | ||||
-rw-r--r-- | server/libs/lua/math.lni | 23 | ||||
-rw-r--r-- | server/locale/en-US/libs/lua/bit32.lni | 57 | ||||
-rw-r--r-- | server/locale/en-US/libs/lua/math.lni | 6 | ||||
-rw-r--r-- | server/locale/zh-CN/libs/lua/bit32.lni | 55 | ||||
-rw-r--r-- | server/locale/zh-CN/libs/lua/math.lni | 6 |
6 files changed, 283 insertions, 0 deletions
diff --git a/server/libs/lua/bit32.lni b/server/libs/lua/bit32.lni new file mode 100644 index 00000000..6920323c --- /dev/null +++ b/server/libs/lua/bit32.lni @@ -0,0 +1,136 @@ +[bit32] +version = 'Lua 5.2' +type = 'table' +[[.source]] +type = 'global' +`````````` +type = 'library' +name = 'bit32' + +<default> +version = 'Lua 5.2' +type = 'function' +parent = { + 1 = { + type = 'global', + name = 'bit32', + }, + 2 = { + type = 'library', + name = 'bit32', + } +} + +[arshift] +[[.args]] +name = x +type = integer +`````````` +name = disp +type = integer +[[.returns]] +type = integer + +[band] +[[.args]] +type = '...' +[[.returns]] +type = integer + +[bnot] +[[.args]] +name = x +type = integer +[[.returns]] +type = integer + +[bor] +[[.args]] +type = '...' +[[.returns]] +type = integer + +[btest] +[[.args]] +type = '...' +[[.returns]] +type = boolean + +[bxor] +[[.args]] +type = '...' +[[.returns]] +type = integer + +[extract] +[[.args]] +name = n +type = integer +`````````` +name = field +type = integer +`````````` +name = width +type = integer +optional = after +default = 1 +[[.returns]] +type = integer + +[replace] +[[.args]] +name = n +type = integer +`````````` +name = v +type = integer +`````````` +name = field +type = integer +`````````` +name = width +type = integer +optional = false +default = 1 +[[.returns]] +type = integer + +[lrotate] +[[.args]] +name = x +type = integer +`````````` +name = disp +type = integer +[[.returns]] +type = integer + +[lshift] +[[.args]] +name = x +type = integer +`````````` +name = disp +type = integer +[[.returns]] +type = integer + +[rrotate] +[[.args]] +name = x +type = integer +`````````` +name = disp +type = integer +[[.returns]] +type = integer + +[rshift] +[[.args]] +name = x +type = integer +`````````` +name = disp +type = integer +[[.returns]] +type = integer diff --git a/server/libs/lua/math.lni b/server/libs/lua/math.lni index 4098d29e..4f807b0c 100644 --- a/server/libs/lua/math.lni +++ b/server/libs/lua/math.lni @@ -129,9 +129,32 @@ type = 'number' [[.returns]] type = 'number' +[frexp] +version = {'Lua 5.1', 'Lua 5.2'} +[[.args]] +name = 'x' +type = 'number' +[[.returns]] +name = 'm' +type = 'number' +`````````` +name = 'e' +type = 'number' + [huge] type = 'number' +[ldexp] +version = {'Lua 5.1', 'Lua 5.2'} +[[.args]] +name = 'm' +type = 'number' +`````````` +name = 'e' +type = 'integer' +[[.returns]] +type = 'number' + [log] [[.args]] name = 'x' diff --git a/server/locale/en-US/libs/lua/bit32.lni b/server/locale/en-US/libs/lua/bit32.lni new file mode 100644 index 00000000..13630970 --- /dev/null +++ b/server/locale/en-US/libs/lua/bit32.lni @@ -0,0 +1,57 @@ +[arshift] +description = [[ +Returns the number `x` shifted `disp` bits to the right. Negative displacements shift to the left. + +This shift operation is what is called arithmetic shift. Vacant bits on the left are filled with copies of the higher bit of `x`; vacant bits on the right are filled with zeros. +]] + +[band] +description = 'Returns the bitwise *and* of its operands.' + +[bnot] +description = [[ +Returns the bitwise negation of `x`. + +```lua +assert(bit32.bnot(x) == (-1 - x) % 2^32) +``` +]] + +[bor] +description = 'Returns the bitwise *or* of its operands.' + +[btest] +description = 'Returns a boolean signaling whether the bitwise *and* of its operands is different from zero.' + +[bxor] +description = 'Returns the bitwise *exclusive or* of its operands.' + +[extract] +description = 'Returns the unsigned number formed by the bits `field` to `field + width - 1` from `n`.' + +[replace] +description = 'Returns a copy of `n` with the bits `field` to `field + width - 1` replaced by the value `v` .' + +[lrotate] +description = 'Returns the number `x` rotated `disp` bits to the left. Negative displacements rotate to the right.' + +[lshift] +description = [[ +Returns the number `x` shifted `disp` bits to the left. Negative displacements shift to the right. In any direction, vacant bits are filled with zeros. + +```lua +assert(bit32.lshift(b, disp) == (b * 2^disp) % 2^32) +``` +]] + +[rrotate] +description = 'Returns the number `x` rotated `disp` bits to the right. Negative displacements rotate to the left.' + +[rshift] +description = [[ +Returns the number `x` shifted `disp` bits to the right. Negative displacements shift to the left. In any direction, vacant bits are filled with zeros. + +```lua +assert(bit32.rshift(b, disp) == math.floor(b % 2^32 / 2^disp)) +``` +]] diff --git a/server/locale/en-US/libs/lua/math.lni b/server/locale/en-US/libs/lua/math.lni index c731511b..0a89176e 100644 --- a/server/locale/en-US/libs/lua/math.lni +++ b/server/locale/en-US/libs/lua/math.lni @@ -37,12 +37,18 @@ description = 'Returns the largest integral value smaller than or equal to `x`.' [fmod] description = 'Returns the remainder of the division of `x` by `y` that rounds the quotient towards zero.' +[frexp] +description = 'Decompose `x` into tails and exponents. Returns `m` and `e` such that `x = m * (2 ^ e)`, `e` is an integer and the absolute value of `m` is in the range [0.5, 1) (or zero when `x` is zero).' + [huge] description = 'A value larger than any other numeric value.' [log] description = 'Returns the logarithm of `x` in the given base.' +[ldexp] +description = 'Returns `m * (2 ^ e)` .' + [max] description = 'Returns the argument with the maximum value, according to the Lua operator `<`.' diff --git a/server/locale/zh-CN/libs/lua/bit32.lni b/server/locale/zh-CN/libs/lua/bit32.lni new file mode 100644 index 00000000..35aa22cc --- /dev/null +++ b/server/locale/zh-CN/libs/lua/bit32.lni @@ -0,0 +1,55 @@ +[arshift] +description = [[ +返回 `x` 向右位移 `disp` 位的结果。`disp` 为负时向左位移。这是算数位移操作,左侧的空位使用 `x` 的高位填充,右侧空位使用 `0` 填充。 +]] + +[band] +description = '返回参数按位与的结果。' + +[bnot] +description = [[ +返回 `x` 按位取反的结果。 + +```lua +assert(bit32.bnot(x) == (-1 - x) % 2^32) +``` +]] + +[bor] +description = '返回参数按位或的结果。' + +[btest] +description = '参数按位与的结果不为0时,返回 `true` 。' + +[bxor] +description = '返回参数按位异或的结果。' + +[extract] +description = '返回 `n` 中第 `field` 到第 `field + width - 1` 位组成的结果。' + +[replace] +description = '返回 `v` 的第 `field` 到第 `field + width - 1` 位替换 `n` 的对应位后的结果。' + +[lrotate] +description = '返回 `x` 向左旋转 `disp` 位的结果。`disp` 为负时向右旋转。' + +[lshift] +description = [[ +返回 `x` 向左位移 `disp` 位的结果。`disp` 为负时向右位移。空位总是使用 `0` 填充。 + +```lua +assert(bit32.lshift(b, disp) == (b * 2^disp) % 2^32) +``` +]] + +[rrotate] +description = '返回 `x` 向右旋转 `disp` 位的结果。`disp` 为负时向左旋转。' + +[rshift] +description = [[ +返回 `x` 向右位移 `disp` 位的结果。`disp` 为负时向左位移。空位总是使用 `0` 填充。 + +```lua +assert(bit32.lshift(b, disp) == (b * 2^disp) % 2^32) +``` +]] diff --git a/server/locale/zh-CN/libs/lua/math.lni b/server/locale/zh-CN/libs/lua/math.lni index 1377918c..ec1cfe9b 100644 --- a/server/locale/zh-CN/libs/lua/math.lni +++ b/server/locale/zh-CN/libs/lua/math.lni @@ -37,9 +37,15 @@ description = '返回不大于 `x` 的最大整数值。' [fmod] description = '返回 `x` 除以 `y`,将商向零圆整后的余数。' +[frexp] +description = '将 `x` 分解为尾数与指数,返回值符合 `x = m * (2 ^ e)` 。`e` 是一个整数,`m` 是 [0.5, 1) 之间的规格化小数 (`x` 为0时 `m` 为0)。' + [huge] description = '一个比任何数字值都大的浮点数。' +[ldexp] +description = '返回 `m * (2 ^ e)` 。' + [log] description = '返回以指定底的 `x` 的对数。' |