From b514932ba1a3b300c88ec6b25cd8113c66e3225e Mon Sep 17 00:00:00 2001 From: Dekkonot Date: Wed, 8 Nov 2023 08:50:37 -0800 Subject: [PATCH 1/4] Add buffer library to Luau standard library --- selene-lib/default_std/luau.yml | 148 ++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) diff --git a/selene-lib/default_std/luau.yml b/selene-lib/default_std/luau.yml index 8d41cb45..e4d1a3ec 100644 --- a/selene-lib/default_std/luau.yml +++ b/selene-lib/default_std/luau.yml @@ -72,6 +72,154 @@ globals: - type: number - type: number must_use: true + buffer.create: + arg: + - type: number + must_use: true + buffer.copy: + arg: + - type: + display: buffer + - type: number + - type: + display: buffer + - required: false + type: number + - required: false + type: number + buffer.fill: + arg: + - type: + display: buffer + - type: number + - type: number + - required: false + type: number + buffer.fromstring: + arg: + - type: string + must_use: true + buffer.len: + arg: + - type: + display: buffer + must_use: true + buffer.readi8: + arg: + - type: + display: buffer + - type: number + must_use: true + buffer.readi16: + arg: + - type: + display: buffer + - type: number + must_use: true + buffer.readi32: + arg: + - type: + display: buffer + - type: number + must_use: true + buffer.readf32: + arg: + - type: + display: buffer + - type: number + must_use: true + buffer.readf64: + arg: + - type: + display: buffer + - type: number + must_use: true + buffer.readu8: + arg: + - type: + display: buffer + - type: number + must_use: true + buffer.readu16: + arg: + - type: + display: buffer + - type: number + must_use: true + buffer.readu32: + arg: + - type: + display: buffer + - type: number + must_use: true + buffer.readstring: + arg: + - type: + display: buffer + - type: number + - type: number + must_use: true + buffer.tostring: + arg: + - type: + display: buffer + must_use: true + buffer.writei8: + arg: + - type: + display: buffer + - type: number + - type: number + buffer.writei16: + arg: + - type: + display: buffer + - type: number + - type: number + buffer.writei32: + arg: + - type: + display: buffer + - type: number + - type: number + buffer.writef32: + arg: + - type: + display: buffer + - type: number + - type: number + buffer.writef64: + arg: + - type: + display: buffer + - type: number + - type: number + buffer.writeu8: + arg: + - type: + display: buffer + - type: number + - type: number + buffer.writeu16: + arg: + - type: + display: buffer + - type: number + - type: number + buffer.writeu32: + arg: + - type: + display: buffer + - type: number + - type: number + buffer.writestring: + arg: + - type: + display: buffer + - type: number + - type: string + - required: false + type: number collectgarbage: args: - type: From 645ee250d38ac0c9838519072a48bc1a0fb8bd17 Mon Sep 17 00:00:00 2001 From: Dekkonot Date: Wed, 8 Nov 2023 08:55:02 -0800 Subject: [PATCH 2/4] ...Use the correct name for args --- selene-lib/default_std/luau.yml | 48 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/selene-lib/default_std/luau.yml b/selene-lib/default_std/luau.yml index e4d1a3ec..bc6ae80c 100644 --- a/selene-lib/default_std/luau.yml +++ b/selene-lib/default_std/luau.yml @@ -73,11 +73,11 @@ globals: - type: number must_use: true buffer.create: - arg: + args: - type: number must_use: true buffer.copy: - arg: + args: - type: display: buffer - type: number @@ -88,7 +88,7 @@ globals: - required: false type: number buffer.fill: - arg: + args: - type: display: buffer - type: number @@ -96,124 +96,124 @@ globals: - required: false type: number buffer.fromstring: - arg: + args: - type: string must_use: true buffer.len: - arg: + args: - type: display: buffer must_use: true buffer.readi8: - arg: + args: - type: display: buffer - type: number must_use: true buffer.readi16: - arg: + args: - type: display: buffer - type: number must_use: true buffer.readi32: - arg: + args: - type: display: buffer - type: number must_use: true buffer.readf32: - arg: + args: - type: display: buffer - type: number must_use: true buffer.readf64: - arg: + args: - type: display: buffer - type: number must_use: true buffer.readu8: - arg: + args: - type: display: buffer - type: number must_use: true buffer.readu16: - arg: + args: - type: display: buffer - type: number must_use: true buffer.readu32: - arg: + args: - type: display: buffer - type: number must_use: true buffer.readstring: - arg: + args: - type: display: buffer - type: number - type: number must_use: true buffer.tostring: - arg: + args: - type: display: buffer must_use: true buffer.writei8: - arg: + args: - type: display: buffer - type: number - type: number buffer.writei16: - arg: + args: - type: display: buffer - type: number - type: number buffer.writei32: - arg: + args: - type: display: buffer - type: number - type: number buffer.writef32: - arg: + args: - type: display: buffer - type: number - type: number buffer.writef64: - arg: + args: - type: display: buffer - type: number - type: number buffer.writeu8: - arg: + args: - type: display: buffer - type: number - type: number buffer.writeu16: - arg: + args: - type: display: buffer - type: number - type: number buffer.writeu32: - arg: + args: - type: display: buffer - type: number - type: number buffer.writestring: - arg: + args: - type: display: buffer - type: number From 1c387ac1ec857b2d790ded7237b0f5b6fb0134f6 Mon Sep 17 00:00:00 2001 From: Dekkonot Date: Wed, 8 Nov 2023 09:03:09 -0800 Subject: [PATCH 3/4] update changelog :-) --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6015620..b4e6f18d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Added `no-exclude` cli flag to disable excludes. - When given in standard library format, additional information now shows up in `incorrect_standard_library_use` missing required parameter errors. - Added new [`mixed_table` lint](https://kampfkarren.github.io/selene/lints/mixed_table.html), which will warn against mixed tables. +- Added `buffer` library to Luau standard library ### Fixed - `string.pack` and `string.unpack` now have proper function signatures in the Lua 5.3 standard library. From 896a2895f55dbdadc16a7ef09b294407a4a5993c Mon Sep 17 00:00:00 2001 From: Dekkonot Date: Wed, 8 Nov 2023 09:43:58 -0800 Subject: [PATCH 4/4] Fix alphabetical order --- selene-lib/default_std/luau.yml | 54 ++++++++++++++++----------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/selene-lib/default_std/luau.yml b/selene-lib/default_std/luau.yml index bc6ae80c..381d7555 100644 --- a/selene-lib/default_std/luau.yml +++ b/selene-lib/default_std/luau.yml @@ -72,10 +72,6 @@ globals: - type: number - type: number must_use: true - buffer.create: - args: - - type: number - must_use: true buffer.copy: args: - type: @@ -87,6 +83,10 @@ globals: type: number - required: false type: number + buffer.create: + args: + - type: number + must_use: true buffer.fill: args: - type: @@ -104,122 +104,122 @@ globals: - type: display: buffer must_use: true - buffer.readi8: + buffer.readf32: args: - type: display: buffer - type: number must_use: true - buffer.readi16: + buffer.readf64: args: - type: display: buffer - type: number must_use: true - buffer.readi32: + buffer.readi8: args: - type: display: buffer - type: number must_use: true - buffer.readf32: + buffer.readi16: args: - type: display: buffer - type: number must_use: true - buffer.readf64: + buffer.readi32: args: - type: display: buffer - type: number must_use: true - buffer.readu8: + buffer.readstring: args: - type: display: buffer - type: number + - type: number must_use: true - buffer.readu16: + buffer.readu8: args: - type: display: buffer - type: number must_use: true - buffer.readu32: + buffer.readu16: args: - type: display: buffer - type: number must_use: true - buffer.readstring: + buffer.readu32: args: - type: display: buffer - type: number - - type: number must_use: true buffer.tostring: args: - type: display: buffer must_use: true - buffer.writei8: + buffer.writef32: args: - type: display: buffer - type: number - type: number - buffer.writei16: + buffer.writef64: args: - type: display: buffer - type: number - type: number - buffer.writei32: + buffer.writei8: args: - type: display: buffer - type: number - type: number - buffer.writef32: + buffer.writei16: args: - type: display: buffer - type: number - type: number - buffer.writef64: + buffer.writei32: args: - type: display: buffer - type: number - type: number - buffer.writeu8: + buffer.writestring: args: - type: display: buffer - type: number - - type: number - buffer.writeu16: + - type: string + - required: false + type: number + buffer.writeu8: args: - type: display: buffer - type: number - type: number - buffer.writeu32: + buffer.writeu16: args: - type: display: buffer - type: number - type: number - buffer.writestring: + buffer.writeu32: args: - type: display: buffer - type: number - - type: string - - required: false - type: number + - type: number collectgarbage: args: - type: