From 7a8afb568fbe25151b2555ae2c2837d72d93412a Mon Sep 17 00:00:00 2001 From: Stephen Leitnick Date: Thu, 1 Feb 2024 10:17:57 -0500 Subject: [PATCH 1/3] GetServices and GetControllers --- src/KnitClient.lua | 10 ++++++++++ src/KnitServer.lua | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/KnitClient.lua b/src/KnitClient.lua index ff48976f..c46a9108 100644 --- a/src/KnitClient.lua +++ b/src/KnitClient.lua @@ -290,6 +290,14 @@ function KnitClient.GetController(controllerName: string): Controller error(`Could not find controller "{controllerName}". Check to verify a controller with this name exists.`, 2) end +--[=[ + Gets a table of all controllers. +]=] +function KnitClient.GetControllers(): { [string]: Controller } + assert(started, "Cannot call GetControllers until Knit has been started") + return controllers +end + --[=[ @return Promise Starts Knit. Should only be called once per client. @@ -314,6 +322,8 @@ function KnitClient.Start(options: KnitOptions?) started = true + table.freeze(controllers) + if options == nil then selectedOptions = defaultOptions else diff --git a/src/KnitServer.lua b/src/KnitServer.lua index 5d1435c9..ee25c5b5 100644 --- a/src/KnitServer.lua +++ b/src/KnitServer.lua @@ -239,6 +239,14 @@ function KnitServer.GetService(serviceName: string): Service return assert(services[serviceName], `Could not find service "{serviceName}"`) :: Service end +--[=[ + Gets a table of all services. +]=] +function KnitServer.GetServices(): { [string]: Service } + assert(started, "Cannot call GetServices until Knit has been started") + return services +end + --[=[ @return SIGNAL_MARKER Returns a marker that will transform the current key into @@ -364,6 +372,8 @@ function KnitServer.Start(options: KnitOptions?) started = true + table.freeze(services) + if options == nil then selectedOptions = defaultOptions else From ec41d841269243275f91ed4dd793c6b05484c97c Mon Sep 17 00:00:00 2001 From: Stephen Leitnick Date: Thu, 1 Feb 2024 10:21:48 -0500 Subject: [PATCH 2/3] Update CI --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3b64b387..4aba17e3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,7 +16,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Install Aftman - uses: ok-nick/setup-aftman@v0 + uses: ok-nick/setup-aftman@v0.4.2 - name: Lint run: | selene ./src @@ -29,5 +29,5 @@ jobs: - uses: JohnnyMorganz/stylua-action@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - version: v0.19.1 + version: v0.20.0 args: --check ./src From fa8e37d68c62c17cceacb0bfb5e047a3a184a8fa Mon Sep 17 00:00:00 2001 From: Stephen Leitnick Date: Thu, 1 Feb 2024 10:27:30 -0500 Subject: [PATCH 3/3] Version bump --- .github/workflows/release.yaml | 2 +- CHANGELOG.md | 6 ++++++ docs/gettingstarted.md | 2 +- src/wally.toml | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 98cd5cb1..e76d0917 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,7 +13,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Install Aftman - uses: ok-nick/setup-aftman@v0 + uses: ok-nick/setup-aftman@v0.4.2 - name: Publish release to Wally shell: bash env: diff --git a/CHANGELOG.md b/CHANGELOG.md index 36bfb0d2..1ba22d72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.7.0 +- Adds `Knit.GetServices()` function server-side +- Adds `Knit.GetControllers()` function client-side +- Freezes `services`/`controllers` tables so that they can be safely returned in the functions listed above. +- Update GitHub workflow dependencies + ## 1.6.0 - Add support for UnreliableRemoteEvents (using `Knit.CreateUnreliableSignal()` on server) diff --git a/docs/gettingstarted.md b/docs/gettingstarted.md index 9a79dd5d..d76535ad 100644 --- a/docs/gettingstarted.md +++ b/docs/gettingstarted.md @@ -22,7 +22,7 @@ Installing Knit is very simple. Just drop the module into ReplicatedStorage. Kni **Rojo/Wally workflow:** -- Add Knit to your `wally.toml` dependency list (e.g. `Knit = "sleitnick/knit@^1.6"`) +- Add Knit to your `wally.toml` dependency list (e.g. `Knit = "sleitnick/knit@^1.7"`) - Require Knit like any other module grabbed from Wally :::note Wally diff --git a/src/wally.toml b/src/wally.toml index 766acced..11dc2d1f 100644 --- a/src/wally.toml +++ b/src/wally.toml @@ -1,7 +1,7 @@ [package] name = "sleitnick/knit" description = "Knit is a lightweight game framework" -version = "1.6.0" +version = "1.7.0" license = "MIT" registry = "https://github.com/UpliftGames/wally-index" realm = "shared"