Skip to content

Commit

Permalink
feat: add luau types
Browse files Browse the repository at this point in the history
  • Loading branch information
wad4444 committed May 4, 2024
1 parent 964f8cf commit 8864a2c
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion src/init.luau
Original file line number Diff line number Diff line change
@@ -1,4 +1,44 @@
local exports = require(script.exports)
table.freeze(exports)

return exports
export type ServerProxy<K> = {
Start: (ServerProxy<K>?, { Player }) -> ServerProxy<K>,
GetPlayers: (ServerProxy<K>?) -> { Player },
Destroy: (ServerProxy<K>?) -> nil,
} & K & any

export type ClientProxy<K> = {
Destroy: (ClientProxy<K>?) -> nil,
} & K & any

export type FunctionAttributes = {
Unreliable: boolean,
}

export type EffectFields = {
IsDestroyed: boolean,
DestroyOnEnd: boolean,
DestroyOnLifecycleEnd: boolean,
MaxLifetime: number,
DisableLeakWarning: boolean,
Configuration: { unknown },
}

export type EffectImpl<K, V, T...> = {
__index: EffectImpl<K, V, T...>,
OnStart: (Effect<K, V, T...>, T...) -> (),
OnConstruct: (Effect<K, V, T...>) -> (),
new: (T...) -> ServerProxy<K>,
locally: (T...) -> ClientProxy<K>,
} & K

export type Effect<K, V, T...> = typeof(setmetatable({} :: EffectFields, {} :: EffectImpl<K, V, T...>)) & V

type refX = {
CreateEffect: (string) -> EffectImpl<any, any, ...any>,
Configure: ((...any) -> any, FunctionAttributes) -> (),
Start: () -> (),
Register: (Instance) -> (),
}

return exports :: refX

0 comments on commit 8864a2c

Please sign in to comment.