mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
This commit is contained in:
parent
f7ce5f024d
commit
7cdcebf03c
11 changed files with 367 additions and 233 deletions
|
|
@ -1,9 +1,12 @@
|
|||
--!nocheck
|
||||
-- wrapped task library for use in pure luau
|
||||
local task = { spawn = function(thread, ...)
|
||||
local ok, err = coroutine.resume(thread, ...)
|
||||
if not ok then error(err, 3) end
|
||||
end }
|
||||
|
||||
export type Type = RBXScriptSignal & { Fire: (Type, ...any)-> () }
|
||||
|
||||
----------------------------------------------------------------------------------------------------
|
||||
-- Batched Yield-Safe Signal Implementation --
|
||||
-- This is a Signal class which has effectively identical behavior to a --
|
||||
|
|
@ -106,10 +109,12 @@ setmetatable(Connection, {
|
|||
local Signal = {}
|
||||
Signal.__index = Signal
|
||||
|
||||
function Signal.new()
|
||||
Signal.__type = "RBXScriptSignal"
|
||||
|
||||
function Signal.new(): Type
|
||||
return setmetatable({
|
||||
_handlerListHead = false,
|
||||
}, Signal)
|
||||
}, Signal) :: any
|
||||
end
|
||||
|
||||
function Signal:Connect(fn)
|
||||
|
|
@ -174,14 +179,4 @@ function Signal:Once(fn)
|
|||
return cn
|
||||
end
|
||||
|
||||
-- Make signal strict
|
||||
setmetatable(Signal, {
|
||||
__index = function(tb, key)
|
||||
error(("Attempt to get Signal::%s (not a valid member)"):format(tostring(key)), 2)
|
||||
end,
|
||||
__newindex = function(tb, key, value)
|
||||
error(("Attempt to set Signal::%s (not a valid member)"):format(tostring(key)), 2)
|
||||
end
|
||||
})
|
||||
|
||||
return Signal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue