Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
GetServices and GetControllers
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleitnick committed Feb 1, 2024
1 parent 65311cb commit 7a8afb5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/KnitClient.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -314,6 +322,8 @@ function KnitClient.Start(options: KnitOptions?)

started = true

table.freeze(controllers)

if options == nil then
selectedOptions = defaultOptions
else
Expand Down
10 changes: 10 additions & 0 deletions src/KnitServer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -364,6 +372,8 @@ function KnitServer.Start(options: KnitOptions?)

started = true

table.freeze(services)

if options == nil then
selectedOptions = defaultOptions
else
Expand Down

0 comments on commit 7a8afb5

Please sign in to comment.