Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
James committed Sep 30, 2023
1 parent 7c35575 commit 007fc74
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 31 deletions.
16 changes: 4 additions & 12 deletions src/lua/framework/Vendor/Controllers/init.luau
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
local Controllers = { }
local Vendor = script.Parent.Vendor

-- // Variables

Controllers.SignalController = require(Vendor.SignalController.Init)
Controllers.NetworkController = require(Vendor.NetworkController.Init)

-- // Functions

-- // Actions

return Controllers
return {
SignalController = require(Vendor.SignalController.Init),
NetworkController = require(Vendor.NetworkController.Init),
}
18 changes: 5 additions & 13 deletions src/lua/framework/Vendor/Debugger.luau
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,7 @@ function EngineDebugger.Debug(debugHandler: (...any) -> (), arguments: {any} | a

table.insert(EngineDebugger.CachedDebugCalls, arguments)

if not respectDebugger then
if type(arguments) == "table" then
debugHandler(prefix, table.unpack(arguments))
else
debugHandler(`{prefix} {arguments}`)
end
return
end

if (RuntimeContext.Studio and RuntimeSettings.StudioDebugEnabled) or RuntimeSettings.LiveGameDebugEnabled then
if not respectDebugger or(RuntimeContext.Studio and RuntimeSettings.StudioDebugEnabled) or RuntimeSettings.LiveGameDebugEnabled then
if type(arguments) == "table" then
debugHandler(prefix, table.unpack(arguments))
else
Expand Down Expand Up @@ -137,6 +128,7 @@ function EngineDebugger.GetCallStack(instance: LuaSourceContainer, stackName: st
end

function EngineDebugger.DebugInvalidData(paramNumber: number, funcName: string, expectedType: ExpectedType, param: unknown, debugHander: (...any) -> ())
warn("DebugInvalidData is deprecated as of 4.0.0, please Guard instead")
local ParamType = typeof(param)

if ParamType ~= expectedType then
Expand All @@ -155,13 +147,13 @@ function EngineDebugger.LogEvent(instance: LuaSourceContainer, eventName: string
end

if not EngineDebugger.CachedLogs[instance] then
EngineDebugger.CachedDebugCalls[instance] = { }
EngineDebugger.CachedLogs[instance] = { }
end

table.insert(EngineDebugger.CachedDebugCalls[instance], eventName)
table.insert(EngineDebugger.CachedLogs[instance], eventName)

if printLog then
EngineDebugger.Debug(print, eventName, "[Event Log]:")
EngineDebugger.Debug(print, eventName, "[Event]:")
end
end

Expand Down
8 changes: 4 additions & 4 deletions src/lua/framework/Vendor/Types.luau
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ export type ClientNetworkController<T, U> = {
}

export type ServerNetworkController<T, U> = {
Listen: (self: ServerNetworkController<T, U>, func: (sender: Player, data: ({T} | unknown)?) -> ()) -> (),
OnInvoke: (self: ServerNetworkController<T, U>, callback: (sender: Player, data: ({T} | unknown)?) -> ({U} | U)) -> (),
Listen: (self: ServerNetworkController<T, U>, func: (sender: Player, data: (Array<T> | unknown)?) -> ()) -> (),
OnInvoke: (self: ServerNetworkController<T, U>, callback: (sender: Player, data: (Array<T> | unknown)?) -> (Array<U> | U)) -> (),

Fire: (self: ServerNetworkController<T, U>, recipient: Player | {Player}, data: (Array<T> | T)?) -> (),
Fire: (self: ServerNetworkController<T, U>, recipient: Player | Array<Player>, data: (Array<T> | T)?) -> (),
FireAll: (self: ServerNetworkController<T, U>, data: (Array<T> | T)?) -> (),
FireExcept: (self: ServerNetworkController<T, U>, except: Player | {Player}, data: (Array<T> | T)?) -> (),
FireExcept: (self: ServerNetworkController<T, U>, except: Player | Array<Player>, data: (Array<T> | T)?) -> (),
FireInRange: (self: ServerNetworkController<T, U>, comparePoint: Vector3, maximumRange: number, data: (Array<T> | T)?) -> (),

SetRateLimit: (self: ServerNetworkController<T, U>, maxInvokesPerSecond: number, invokeOverflowCallback: (sender: Player) -> ()) -> (),
Expand Down
4 changes: 2 additions & 2 deletions src/lua/framework/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function CanaryEngine.GetEngineServer()
CanaryEngineServer.Data = require(EngineVendor.Libraries.EasyProfile.Init)
return table.freeze(CanaryEngineServer)
else
Debugger.Debug(error, "Failed to fetch 'EngineServer', context must be server.", nil, false)
error("Failed to fetch 'EngineServer', context must be server.")
return
end
end
Expand All @@ -81,7 +81,7 @@ function CanaryEngine.GetEngineClient()

return table.freeze(CanaryEngineClient)
else
Debugger.Debug(error, "Failed to fetch 'EngineClient', context must be client.", nil, false)
error("Failed to fetch 'EngineClient', context must be client.")
return
end
end
Expand Down

0 comments on commit 007fc74

Please sign in to comment.