Skip to content

Commit

Permalink
Added a few Lua 5.2 and 5.3 standard library functions (#497)
Browse files Browse the repository at this point in the history
Didn't add a few package.* as well as debug.* functions.
Also didn't add the Lua 5.3 math.* functions.

Added:

- `bit32` library
- added `table.pack` and `table.move`
- added `rawlen`
- added `package.config`

Changed:

- Moved `math.log` addition to correct version
  • Loading branch information
ccuser44 authored Mar 30, 2023
1 parent b481939 commit bf2aac0
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/Kampfkarren/selene/compare/0.25.0...HEAD)
### Added
- Added `table.move`to Lua 5.3 standard library
- Added `bit32.*` functions to Lua 5.2 standard library
- Added `table.pack`, `rawlen` and `package.config` to Lua 5.2 standard library

### Fixed
- `string.pack` and `string.unpack` now have proper function signatures in the Lua 5.3 standard library.
- Moved `math.log` second argument addition from Lua 5.3 std lib to 5.2 std lib

## [0.25.0](https://github.com/Kampfkarren/selene/releases/tag/0.25.0) - 2023-03-12
### Added
Expand Down
75 changes: 75 additions & 0 deletions selene-lib/default_std/lua52.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,85 @@
---
base: lua51
globals:
bit32.arshift:
args:
- type: number
- type: number
must_use: true
bit32.band:
args:
- type: "..."
must_use: true
bit32.bnot:
args:
- type: number
must_use: true
bit32.bor:
args:
- type: "..."
must_use: true
bit32.btest:
args:
- type: "..."
must_use: true
bit32.bxor:
args:
- type: "..."
must_use: true
bit32.extract:
args:
- type: number
- type: number
- required: false
type: number
must_use: true
bit32.lrotate:
args:
- type: number
- type: number
must_use: true
bit32.lshift:
args:
- type: number
- type: number
must_use: true
bit32.replace:
args:
- type: number
- type: number
- type: number
- required: false
type: number
must_use: true
bit32.rrotate:
args:
- type: number
- type: number
must_use: true
bit32.rshift:
args:
- type: number
- type: number
must_use: true
getfenv:
removed: true
math.log:
args:
- type: number
- required: false
type: number
package.config:
property: read-only
rawlen:
args:
- type: table
must_use: true
setfenv:
removed: true
table.pack:
args:
- type: "..."
must_use: true
table.unpack:
args:
- type: table
Expand Down
13 changes: 8 additions & 5 deletions selene-lib/default_std/lua53.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
---
base: lua52
globals:
math.log:
args:
- type: number
- required: false
type: number
string.pack:
args:
- type: string
Expand All @@ -20,6 +15,14 @@ globals:
- type: string
- type: ...
must_use: true
table.move:
args:
- type: table
- type: number
- type: number
- type: number
- required: false
type: table
utf8.char:
args:
- required: utf8.char should be used with an argument despite it not throwing
Expand Down

0 comments on commit bf2aac0

Please sign in to comment.