cluaupp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/LICENSE +21 -0
- package/README.md +119 -0
- package/bin/cluau.js +4 -0
- package/bin/cluaupp.js +4 -0
- package/docs/README.md +20 -0
- package/docs/architecture.md +110 -0
- package/docs/cli.md +69 -0
- package/docs/comparison.md +37 -0
- package/docs/config.md +31 -0
- package/docs/cpp-advanced.md +71 -0
- package/docs/cpp-const.md +52 -0
- package/docs/cpp-organization.md +61 -0
- package/docs/cpp-safety.md +58 -0
- package/docs/cpp-types.md +66 -0
- package/docs/getting-started.md +169 -0
- package/docs/intro.md +37 -0
- package/docs/libraries.md +77 -0
- package/docs/roblox-api.md +81 -0
- package/docs/syntax.md +131 -0
- package/include/cluaupp/datatypes.hpp +581 -0
- package/include/cluaupp/generated/enums.hpp +4920 -0
- package/include/cluaupp/generated/instances.hpp +12489 -0
- package/include/cluaupp/libs/chrono.hpp +26 -0
- package/include/cluaupp/libs/cmdr.hpp +16 -0
- package/include/cluaupp/libs/dataservice.hpp +141 -0
- package/include/cluaupp/libs/display.hpp +13 -0
- package/include/cluaupp/libs/ezvisual.hpp +18 -0
- package/include/cluaupp/libs/formatnumber.hpp +15 -0
- package/include/cluaupp/libs/fusion.hpp +41 -0
- package/include/cluaupp/libs/iris.hpp +40 -0
- package/include/cluaupp/libs/janitor.hpp +35 -0
- package/include/cluaupp/libs/math.hpp +14 -0
- package/include/cluaupp/libs/module3d.hpp +25 -0
- package/include/cluaupp/libs/net.hpp +42 -0
- package/include/cluaupp/libs/promise.hpp +30 -0
- package/include/cluaupp/libs/spring.hpp +18 -0
- package/include/cluaupp/libs/statemachine.hpp +19 -0
- package/include/cluaupp/libs/stickybillboard.hpp +14 -0
- package/include/cluaupp/libs/topbarplus.hpp +29 -0
- package/include/cluaupp/libs/twinkle.hpp +15 -0
- package/include/cluaupp/libs/vfx.hpp +13 -0
- package/include/cluaupp/libs.hpp +25 -0
- package/include/cluaupp/roblox.hpp +28 -0
- package/package.json +65 -0
- package/runtime/ArrayIndexer/init.luau +144 -0
- package/runtime/Chrono/Client/ClientClock.luau +202 -0
- package/runtime/Chrono/Client/InterpolationBuffer.luau +74 -0
- package/runtime/Chrono/Client/ModelResolver.luau +53 -0
- package/runtime/Chrono/Client/Player.luau +113 -0
- package/runtime/Chrono/Client/Receiver.luau +395 -0
- package/runtime/Chrono/Client/Replicate.luau +333 -0
- package/runtime/Chrono/Client/Sender.luau +205 -0
- package/runtime/Chrono/LICENSE +21 -0
- package/runtime/Chrono/Server/EntityGrid.luau +299 -0
- package/runtime/Chrono/Server/Player.luau +141 -0
- package/runtime/Chrono/Server/Receiver.luau +287 -0
- package/runtime/Chrono/Server/Replicate.luau +415 -0
- package/runtime/Chrono/Server/Sender.luau +306 -0
- package/runtime/Chrono/Server/ServerClock.luau +50 -0
- package/runtime/Chrono/Shared/ApplyMounts.luau +137 -0
- package/runtime/Chrono/Shared/Bin.luau +31 -0
- package/runtime/Chrono/Shared/ClockUnwrap.luau +70 -0
- package/runtime/Chrono/Shared/Config.luau +264 -0
- package/runtime/Chrono/Shared/Entity.luau +1016 -0
- package/runtime/Chrono/Shared/Events.luau +39 -0
- package/runtime/Chrono/Shared/Holder.luau +210 -0
- package/runtime/Chrono/Shared/InterpolationMath.luau +51 -0
- package/runtime/Chrono/Shared/ModelHelper.luau +122 -0
- package/runtime/Chrono/Shared/Remotes/ClientClockRelay.model.json +3 -0
- package/runtime/Chrono/Shared/Remotes/ClientHeartbeat.model.json +3 -0
- package/runtime/Chrono/Shared/Remotes/ClientLoaded.model.json +3 -0
- package/runtime/Chrono/Shared/Remotes/Death.model.json +3 -0
- package/runtime/Chrono/Shared/Remotes/Heartbeat.model.json +3 -0
- package/runtime/Chrono/Shared/Remotes/Replicate.model.json +3 -0
- package/runtime/Chrono/Shared/Remotes/ReplicateFull.model.json +3 -0
- package/runtime/Chrono/Shared/Remotes/SafeReplicate.model.json +3 -0
- package/runtime/Chrono/Shared/ReplicationRules.luau +122 -0
- package/runtime/Chrono/Shared/Signal.luau +219 -0
- package/runtime/Chrono/Shared/Snapshots.luau +218 -0
- package/runtime/Chrono/Shared/Stats.luau +204 -0
- package/runtime/Chrono/Shared/Ticker.luau +112 -0
- package/runtime/Chrono/Shared/Types.luau +247 -0
- package/runtime/Chrono/Shared/Warn.luau +33 -0
- package/runtime/Chrono/Shared/_CUSTOM_MODEL_REP/init.model.json +3 -0
- package/runtime/Chrono/_impl/Client/ClientClock.luau +202 -0
- package/runtime/Chrono/_impl/Client/InterpolationBuffer.luau +74 -0
- package/runtime/Chrono/_impl/Client/ModelResolver.luau +53 -0
- package/runtime/Chrono/_impl/Client/Player.luau +113 -0
- package/runtime/Chrono/_impl/Client/Receiver.luau +395 -0
- package/runtime/Chrono/_impl/Client/Replicate.luau +333 -0
- package/runtime/Chrono/_impl/Client/Sender.luau +205 -0
- package/runtime/Chrono/_impl/LICENSE +21 -0
- package/runtime/Chrono/_impl/Server/EntityGrid.luau +299 -0
- package/runtime/Chrono/_impl/Server/Player.luau +141 -0
- package/runtime/Chrono/_impl/Server/Receiver.luau +287 -0
- package/runtime/Chrono/_impl/Server/Replicate.luau +415 -0
- package/runtime/Chrono/_impl/Server/Sender.luau +306 -0
- package/runtime/Chrono/_impl/Server/ServerClock.luau +50 -0
- package/runtime/Chrono/_impl/Shared/ApplyMounts.luau +137 -0
- package/runtime/Chrono/_impl/Shared/Bin.luau +31 -0
- package/runtime/Chrono/_impl/Shared/ClockUnwrap.luau +70 -0
- package/runtime/Chrono/_impl/Shared/Config.luau +264 -0
- package/runtime/Chrono/_impl/Shared/Entity.luau +1016 -0
- package/runtime/Chrono/_impl/Shared/Events.luau +39 -0
- package/runtime/Chrono/_impl/Shared/Holder.luau +210 -0
- package/runtime/Chrono/_impl/Shared/InterpolationMath.luau +51 -0
- package/runtime/Chrono/_impl/Shared/ModelHelper.luau +122 -0
- package/runtime/Chrono/_impl/Shared/Remotes/ClientClockRelay.model.json +3 -0
- package/runtime/Chrono/_impl/Shared/Remotes/ClientHeartbeat.model.json +3 -0
- package/runtime/Chrono/_impl/Shared/Remotes/ClientLoaded.model.json +3 -0
- package/runtime/Chrono/_impl/Shared/Remotes/Death.model.json +3 -0
- package/runtime/Chrono/_impl/Shared/Remotes/Heartbeat.model.json +3 -0
- package/runtime/Chrono/_impl/Shared/Remotes/Replicate.model.json +3 -0
- package/runtime/Chrono/_impl/Shared/Remotes/ReplicateFull.model.json +3 -0
- package/runtime/Chrono/_impl/Shared/Remotes/SafeReplicate.model.json +3 -0
- package/runtime/Chrono/_impl/Shared/ReplicationRules.luau +122 -0
- package/runtime/Chrono/_impl/Shared/Signal.luau +219 -0
- package/runtime/Chrono/_impl/Shared/Snapshots.luau +218 -0
- package/runtime/Chrono/_impl/Shared/Stats.luau +204 -0
- package/runtime/Chrono/_impl/Shared/Ticker.luau +112 -0
- package/runtime/Chrono/_impl/Shared/Types.luau +247 -0
- package/runtime/Chrono/_impl/Shared/Warn.luau +33 -0
- package/runtime/Chrono/_impl/Shared/_CUSTOM_MODEL_REP/init.model.json +3 -0
- package/runtime/Chrono/_impl/init.luau +96 -0
- package/runtime/Chrono/init.luau +14 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/announce.luau +21 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/announceServer.luau +17 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/ban.luau +59 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/banServer.luau +30 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/gotoPlace.luau +35 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/gotoPlaceServer.luau +17 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/kick.luau +19 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/kickServer.luau +27 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/kill.luau +13 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/killServer.luau +13 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/respawn.luau +15 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/respawnServer.luau +7 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/teleport.luau +30 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/teleportServer.luau +26 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/unban.luau +26 -0
- package/runtime/Cmdr/BuiltInCommands/Admin/unbanServer.luau +10 -0
- package/runtime/Cmdr/BuiltInCommands/Debug/blink.luau +35 -0
- package/runtime/Cmdr/BuiltInCommands/Debug/fetch.luau +12 -0
- package/runtime/Cmdr/BuiltInCommands/Debug/fetchServer.luau +7 -0
- package/runtime/Cmdr/BuiltInCommands/Debug/getPlayerPlaceInstance.luau +20 -0
- package/runtime/Cmdr/BuiltInCommands/Debug/getPlayerPlaceInstanceServer.luau +28 -0
- package/runtime/Cmdr/BuiltInCommands/Debug/position.luau +30 -0
- package/runtime/Cmdr/BuiltInCommands/Debug/thru.luau +50 -0
- package/runtime/Cmdr/BuiltInCommands/Debug/uptime.luau +6 -0
- package/runtime/Cmdr/BuiltInCommands/Debug/uptimeServer.luau +12 -0
- package/runtime/Cmdr/BuiltInCommands/Debug/version.luau +12 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/alias.luau +22 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/bind.luau +104 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/clear.luau +20 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/convertTimestamp.luau +18 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/echo.luau +17 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/edit.luau +75 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/exit.luau +11 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/history.luau +27 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/hover.luau +21 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/jsonArrayDecode.luau +25 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/jsonArrayEncode.luau +18 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/len.luau +16 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/math.luau +36 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/pick.luau +21 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/rand.luau +27 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/replace.luau +32 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/resolve.luau +32 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/run.luau +20 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/runLines.luau +34 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/runif.luau +95 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/unbind.luau +27 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/var.luau +29 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/varServer.luau +37 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/varSet.luau +30 -0
- package/runtime/Cmdr/BuiltInCommands/Utility/varSetServer.luau +29 -0
- package/runtime/Cmdr/BuiltInCommands/help.luau +96 -0
- package/runtime/Cmdr/BuiltInTypes/BrickColor.luau +258 -0
- package/runtime/Cmdr/BuiltInTypes/Color3.luau +59 -0
- package/runtime/Cmdr/BuiltInTypes/Command.luau +23 -0
- package/runtime/Cmdr/BuiltInTypes/Duration.luau +111 -0
- package/runtime/Cmdr/BuiltInTypes/JSON.luau +13 -0
- package/runtime/Cmdr/BuiltInTypes/MathOperator.luau +43 -0
- package/runtime/Cmdr/BuiltInTypes/Player.luau +36 -0
- package/runtime/Cmdr/BuiltInTypes/PlayerId.luau +66 -0
- package/runtime/Cmdr/BuiltInTypes/Primitives.luau +145 -0
- package/runtime/Cmdr/BuiltInTypes/StoredKey.luau +33 -0
- package/runtime/Cmdr/BuiltInTypes/Team.luau +49 -0
- package/runtime/Cmdr/BuiltInTypes/Type.luau +23 -0
- package/runtime/Cmdr/BuiltInTypes/URL.luau +18 -0
- package/runtime/Cmdr/BuiltInTypes/UserInput.luau +32 -0
- package/runtime/Cmdr/BuiltInTypes/Vector.luau +58 -0
- package/runtime/Cmdr/CmdrClient/CmdrInterface/AutoComplete.luau +240 -0
- package/runtime/Cmdr/CmdrClient/CmdrInterface/CreateGui.luau +227 -0
- package/runtime/Cmdr/CmdrClient/CmdrInterface/Window.luau +713 -0
- package/runtime/Cmdr/CmdrClient/CmdrInterface/init.luau +18 -0
- package/runtime/Cmdr/CmdrClient/DefaultEventHandlers.luau +18 -0
- package/runtime/Cmdr/CmdrClient/Shared/Argument.luau +395 -0
- package/runtime/Cmdr/CmdrClient/Shared/BuiltInGuards/HasCharacter.luau +39 -0
- package/runtime/Cmdr/CmdrClient/Shared/BuiltInGuards/IsDataStoreAvailable.luau +36 -0
- package/runtime/Cmdr/CmdrClient/Shared/BuiltInGuards/MaxArrayLength.luau +10 -0
- package/runtime/Cmdr/CmdrClient/Shared/BuiltInGuards/MaxStringLength.luau +10 -0
- package/runtime/Cmdr/CmdrClient/Shared/BuiltInGuards/NonEmptyString.luau +10 -0
- package/runtime/Cmdr/CmdrClient/Shared/BuiltInGuards/NotEquals.luau +8 -0
- package/runtime/Cmdr/CmdrClient/Shared/Command.luau +415 -0
- package/runtime/Cmdr/CmdrClient/Shared/Dispatcher.luau +407 -0
- package/runtime/Cmdr/CmdrClient/Shared/Registry.luau +717 -0
- package/runtime/Cmdr/CmdrClient/Shared/Util.luau +879 -0
- package/runtime/Cmdr/CmdrClient/init.luau +377 -0
- package/runtime/Cmdr/LICENSE +21 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/announce.luau +21 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/announceServer.luau +17 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/ban.luau +59 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/banServer.luau +30 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/gotoPlace.luau +35 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/gotoPlaceServer.luau +17 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/kick.luau +19 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/kickServer.luau +27 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/kill.luau +13 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/killServer.luau +13 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/respawn.luau +15 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/respawnServer.luau +7 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/teleport.luau +30 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/teleportServer.luau +26 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/unban.luau +26 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Admin/unbanServer.luau +10 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Debug/blink.luau +35 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Debug/fetch.luau +12 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Debug/fetchServer.luau +7 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Debug/getPlayerPlaceInstance.luau +20 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Debug/getPlayerPlaceInstanceServer.luau +28 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Debug/position.luau +30 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Debug/thru.luau +50 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Debug/uptime.luau +6 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Debug/uptimeServer.luau +12 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Debug/version.luau +12 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/alias.luau +22 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/bind.luau +104 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/clear.luau +20 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/convertTimestamp.luau +18 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/echo.luau +17 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/edit.luau +75 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/exit.luau +11 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/history.luau +27 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/hover.luau +21 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/jsonArrayDecode.luau +25 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/jsonArrayEncode.luau +18 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/len.luau +16 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/math.luau +36 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/pick.luau +21 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/rand.luau +27 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/replace.luau +32 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/resolve.luau +32 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/run.luau +20 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/runLines.luau +34 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/runif.luau +95 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/unbind.luau +27 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/var.luau +29 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/varServer.luau +37 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/varSet.luau +30 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/Utility/varSetServer.luau +29 -0
- package/runtime/Cmdr/_impl/BuiltInCommands/help.luau +96 -0
- package/runtime/Cmdr/_impl/BuiltInTypes/BrickColor.luau +258 -0
- package/runtime/Cmdr/_impl/BuiltInTypes/Color3.luau +59 -0
- package/runtime/Cmdr/_impl/BuiltInTypes/Command.luau +23 -0
- package/runtime/Cmdr/_impl/BuiltInTypes/Duration.luau +111 -0
- package/runtime/Cmdr/_impl/BuiltInTypes/JSON.luau +13 -0
- package/runtime/Cmdr/_impl/BuiltInTypes/MathOperator.luau +43 -0
- package/runtime/Cmdr/_impl/BuiltInTypes/Player.luau +36 -0
- package/runtime/Cmdr/_impl/BuiltInTypes/PlayerId.luau +66 -0
- package/runtime/Cmdr/_impl/BuiltInTypes/Primitives.luau +145 -0
- package/runtime/Cmdr/_impl/BuiltInTypes/StoredKey.luau +33 -0
- package/runtime/Cmdr/_impl/BuiltInTypes/Team.luau +49 -0
- package/runtime/Cmdr/_impl/BuiltInTypes/Type.luau +23 -0
- package/runtime/Cmdr/_impl/BuiltInTypes/URL.luau +18 -0
- package/runtime/Cmdr/_impl/BuiltInTypes/UserInput.luau +32 -0
- package/runtime/Cmdr/_impl/BuiltInTypes/Vector.luau +58 -0
- package/runtime/Cmdr/_impl/CmdrClient/CmdrInterface/AutoComplete.luau +240 -0
- package/runtime/Cmdr/_impl/CmdrClient/CmdrInterface/CreateGui.luau +227 -0
- package/runtime/Cmdr/_impl/CmdrClient/CmdrInterface/Window.luau +713 -0
- package/runtime/Cmdr/_impl/CmdrClient/CmdrInterface/init.luau +18 -0
- package/runtime/Cmdr/_impl/CmdrClient/DefaultEventHandlers.luau +18 -0
- package/runtime/Cmdr/_impl/CmdrClient/Shared/Argument.luau +395 -0
- package/runtime/Cmdr/_impl/CmdrClient/Shared/BuiltInGuards/HasCharacter.luau +39 -0
- package/runtime/Cmdr/_impl/CmdrClient/Shared/BuiltInGuards/IsDataStoreAvailable.luau +36 -0
- package/runtime/Cmdr/_impl/CmdrClient/Shared/BuiltInGuards/MaxArrayLength.luau +10 -0
- package/runtime/Cmdr/_impl/CmdrClient/Shared/BuiltInGuards/MaxStringLength.luau +10 -0
- package/runtime/Cmdr/_impl/CmdrClient/Shared/BuiltInGuards/NonEmptyString.luau +10 -0
- package/runtime/Cmdr/_impl/CmdrClient/Shared/BuiltInGuards/NotEquals.luau +8 -0
- package/runtime/Cmdr/_impl/CmdrClient/Shared/Command.luau +415 -0
- package/runtime/Cmdr/_impl/CmdrClient/Shared/Dispatcher.luau +407 -0
- package/runtime/Cmdr/_impl/CmdrClient/Shared/Registry.luau +717 -0
- package/runtime/Cmdr/_impl/CmdrClient/Shared/Util.luau +879 -0
- package/runtime/Cmdr/_impl/CmdrClient/init.luau +377 -0
- package/runtime/Cmdr/_impl/LICENSE +21 -0
- package/runtime/Cmdr/_impl/init.luau +178 -0
- package/runtime/Cmdr/init.luau +8 -0
- package/runtime/DataService/Client.luau +209 -0
- package/runtime/DataService/Data.luau +886 -0
- package/runtime/DataService/Enum.luau +6 -0
- package/runtime/DataService/Enums.luau +10 -0
- package/runtime/DataService/Packages/quicknet/DataTypes.luau +70 -0
- package/runtime/DataService/Packages/quicknet/Enums.luau +85 -0
- package/runtime/DataService/Packages/quicknet/EnumsToNativeTypes.luau +57 -0
- package/runtime/DataService/Packages/quicknet/Parser.luau +355 -0
- package/runtime/DataService/Packages/quicknet/QuickNet.luau +953 -0
- package/runtime/DataService/Packages/quicknet/Serialize.luau +2020 -0
- package/runtime/DataService/Packages/quicknet/Types.luau +72 -0
- package/runtime/DataService/Packages/quicknet/init.luau +1 -0
- package/runtime/DataService/Packages/signal/init.luau +433 -0
- package/runtime/DataService/Path.luau +236 -0
- package/runtime/DataService/ProfileStore.luau +2243 -0
- package/runtime/DataService/Replicator.luau +172 -0
- package/runtime/DataService/Server.luau +412 -0
- package/runtime/DataService/init.luau +204 -0
- package/runtime/Display/LICENSE +201 -0
- package/runtime/Display/_impl/LICENSE +201 -0
- package/runtime/Display/_impl/init.luau +269 -0
- package/runtime/Display/_impl/option.luau +237 -0
- package/runtime/Display/init.luau +10 -0
- package/runtime/Display/option.luau +237 -0
- package/runtime/EzVisualz/Dropshadow.luau +148 -0
- package/runtime/EzVisualz/Gradient.luau +452 -0
- package/runtime/EzVisualz/GradientTemplates/Bubblegum.luau +16 -0
- package/runtime/EzVisualz/GradientTemplates/Chrome.luau +16 -0
- package/runtime/EzVisualz/GradientTemplates/Death.luau +15 -0
- package/runtime/EzVisualz/GradientTemplates/Electric.luau +14 -0
- package/runtime/EzVisualz/GradientTemplates/Fire.luau +13 -0
- package/runtime/EzVisualz/GradientTemplates/Galaxy.luau +11 -0
- package/runtime/EzVisualz/GradientTemplates/Ghost.luau +16 -0
- package/runtime/EzVisualz/GradientTemplates/Gold.luau +14 -0
- package/runtime/EzVisualz/GradientTemplates/Green.luau +14 -0
- package/runtime/EzVisualz/GradientTemplates/Ice.luau +14 -0
- package/runtime/EzVisualz/GradientTemplates/Lava.luau +15 -0
- package/runtime/EzVisualz/GradientTemplates/Matrix.luau +19 -0
- package/runtime/EzVisualz/GradientTemplates/Neon.luau +12 -0
- package/runtime/EzVisualz/GradientTemplates/Oceanic.luau +15 -0
- package/runtime/EzVisualz/GradientTemplates/Rainbow.luau +13 -0
- package/runtime/EzVisualz/GradientTemplates/Silver.luau +12 -0
- package/runtime/EzVisualz/GradientTemplates/Sunset.luau +11 -0
- package/runtime/EzVisualz/GradientTemplates/Zebra.luau +18 -0
- package/runtime/EzVisualz/GradientTemplates/init.luau +9 -0
- package/runtime/EzVisualz/LICENSE.md +21 -0
- package/runtime/EzVisualz/Presets/Bubblegum.luau +36 -0
- package/runtime/EzVisualz/Presets/ChromeStroke.luau +15 -0
- package/runtime/EzVisualz/Presets/DeathStroke.luau +15 -0
- package/runtime/EzVisualz/Presets/ElectricStroke.luau +54 -0
- package/runtime/EzVisualz/Presets/FireStroke.luau +29 -0
- package/runtime/EzVisualz/Presets/GalaxyStroke.luau +31 -0
- package/runtime/EzVisualz/Presets/Ghost.luau +10 -0
- package/runtime/EzVisualz/Presets/GhostStroke.luau +15 -0
- package/runtime/EzVisualz/Presets/Gold.luau +10 -0
- package/runtime/EzVisualz/Presets/GoldStroke.luau +15 -0
- package/runtime/EzVisualz/Presets/GreenOutline.luau +23 -0
- package/runtime/EzVisualz/Presets/IceStroke.luau +15 -0
- package/runtime/EzVisualz/Presets/Lava.luau +9 -0
- package/runtime/EzVisualz/Presets/LavaStroke.luau +13 -0
- package/runtime/EzVisualz/Presets/Matrix.luau +21 -0
- package/runtime/EzVisualz/Presets/NeonStroke.luau +30 -0
- package/runtime/EzVisualz/Presets/OceanicStroke.luau +15 -0
- package/runtime/EzVisualz/Presets/Rainbow.luau +9 -0
- package/runtime/EzVisualz/Presets/RainbowOutline.luau +23 -0
- package/runtime/EzVisualz/Presets/RainbowStroke.luau +13 -0
- package/runtime/EzVisualz/Presets/Shine.luau +48 -0
- package/runtime/EzVisualz/Presets/ShineOutline.luau +66 -0
- package/runtime/EzVisualz/Presets/Silver.luau +10 -0
- package/runtime/EzVisualz/Presets/SilverStroke.luau +15 -0
- package/runtime/EzVisualz/Presets/SunsetStroke.luau +31 -0
- package/runtime/EzVisualz/Presets/WaveStroke.luau +33 -0
- package/runtime/EzVisualz/Presets/Zebra.luau +21 -0
- package/runtime/EzVisualz/Presets/init.luau +9 -0
- package/runtime/EzVisualz/Stroke.luau +167 -0
- package/runtime/EzVisualz/Util.luau +7 -0
- package/runtime/EzVisualz/_impl/Dropshadow.luau +148 -0
- package/runtime/EzVisualz/_impl/Gradient.luau +452 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Bubblegum.luau +16 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Chrome.luau +16 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Death.luau +15 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Electric.luau +14 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Fire.luau +13 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Galaxy.luau +11 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Ghost.luau +16 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Gold.luau +14 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Green.luau +14 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Ice.luau +14 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Lava.luau +15 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Matrix.luau +19 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Neon.luau +12 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Oceanic.luau +15 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Rainbow.luau +13 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Silver.luau +12 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Sunset.luau +11 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/Zebra.luau +18 -0
- package/runtime/EzVisualz/_impl/GradientTemplates/init.luau +9 -0
- package/runtime/EzVisualz/_impl/LICENSE.md +21 -0
- package/runtime/EzVisualz/_impl/Presets/Bubblegum.luau +36 -0
- package/runtime/EzVisualz/_impl/Presets/ChromeStroke.luau +15 -0
- package/runtime/EzVisualz/_impl/Presets/DeathStroke.luau +15 -0
- package/runtime/EzVisualz/_impl/Presets/ElectricStroke.luau +54 -0
- package/runtime/EzVisualz/_impl/Presets/FireStroke.luau +29 -0
- package/runtime/EzVisualz/_impl/Presets/GalaxyStroke.luau +31 -0
- package/runtime/EzVisualz/_impl/Presets/Ghost.luau +10 -0
- package/runtime/EzVisualz/_impl/Presets/GhostStroke.luau +15 -0
- package/runtime/EzVisualz/_impl/Presets/Gold.luau +10 -0
- package/runtime/EzVisualz/_impl/Presets/GoldStroke.luau +15 -0
- package/runtime/EzVisualz/_impl/Presets/GreenOutline.luau +23 -0
- package/runtime/EzVisualz/_impl/Presets/IceStroke.luau +15 -0
- package/runtime/EzVisualz/_impl/Presets/Lava.luau +9 -0
- package/runtime/EzVisualz/_impl/Presets/LavaStroke.luau +13 -0
- package/runtime/EzVisualz/_impl/Presets/Matrix.luau +21 -0
- package/runtime/EzVisualz/_impl/Presets/NeonStroke.luau +30 -0
- package/runtime/EzVisualz/_impl/Presets/OceanicStroke.luau +15 -0
- package/runtime/EzVisualz/_impl/Presets/Rainbow.luau +9 -0
- package/runtime/EzVisualz/_impl/Presets/RainbowOutline.luau +23 -0
- package/runtime/EzVisualz/_impl/Presets/RainbowStroke.luau +13 -0
- package/runtime/EzVisualz/_impl/Presets/Shine.luau +48 -0
- package/runtime/EzVisualz/_impl/Presets/ShineOutline.luau +66 -0
- package/runtime/EzVisualz/_impl/Presets/Silver.luau +10 -0
- package/runtime/EzVisualz/_impl/Presets/SilverStroke.luau +15 -0
- package/runtime/EzVisualz/_impl/Presets/SunsetStroke.luau +31 -0
- package/runtime/EzVisualz/_impl/Presets/WaveStroke.luau +33 -0
- package/runtime/EzVisualz/_impl/Presets/Zebra.luau +21 -0
- package/runtime/EzVisualz/_impl/Presets/init.luau +9 -0
- package/runtime/EzVisualz/_impl/Stroke.luau +167 -0
- package/runtime/EzVisualz/_impl/Util.luau +7 -0
- package/runtime/EzVisualz/_impl/init.luau +319 -0
- package/runtime/EzVisualz/_impl/wally.lock +8 -0
- package/runtime/EzVisualz/_impl/wally.toml +8 -0
- package/runtime/EzVisualz/init.luau +9 -0
- package/runtime/EzVisualz/wally.lock +8 -0
- package/runtime/EzVisualz/wally.toml +8 -0
- package/runtime/FormatNumber/LICENSE.md +25 -0
- package/runtime/FormatNumber/Main/DecimalFormatSymbols.lua +43 -0
- package/runtime/FormatNumber/Main/IntegerWidth.lua +41 -0
- package/runtime/FormatNumber/Main/Notation.lua +116 -0
- package/runtime/FormatNumber/Main/Precision.lua +179 -0
- package/runtime/FormatNumber/Main/init.lua +199 -0
- package/runtime/FormatNumber/Simple/init.lua +76 -0
- package/runtime/FormatNumber/Version.lua +82 -0
- package/runtime/FormatNumber/_impl/LICENSE.md +25 -0
- package/runtime/FormatNumber/_impl/Main/DecimalFormatSymbols.lua +43 -0
- package/runtime/FormatNumber/_impl/Main/IntegerWidth.lua +41 -0
- package/runtime/FormatNumber/_impl/Main/Notation.lua +116 -0
- package/runtime/FormatNumber/_impl/Main/Precision.lua +179 -0
- package/runtime/FormatNumber/_impl/Main/init.lua +199 -0
- package/runtime/FormatNumber/_impl/Simple/init.lua +76 -0
- package/runtime/FormatNumber/_impl/Version.lua +82 -0
- package/runtime/FormatNumber/_impl/_internal/class.lua +204 -0
- package/runtime/FormatNumber/_impl/_internal/decimal_conversion.lua +30 -0
- package/runtime/FormatNumber/_impl/_internal/enums.lua +55 -0
- package/runtime/FormatNumber/_impl/_internal/format.lua +342 -0
- package/runtime/FormatNumber/_impl/_internal/formatter_settings.lua +160 -0
- package/runtime/FormatNumber/_impl/_internal/init.lua +8 -0
- package/runtime/FormatNumber/_impl/_internal/skeleton.lua +541 -0
- package/runtime/FormatNumber/_impl/init.lua +20 -0
- package/runtime/FormatNumber/_internal/class.lua +204 -0
- package/runtime/FormatNumber/_internal/decimal_conversion.lua +30 -0
- package/runtime/FormatNumber/_internal/enums.lua +55 -0
- package/runtime/FormatNumber/_internal/format.lua +342 -0
- package/runtime/FormatNumber/_internal/formatter_settings.lua +160 -0
- package/runtime/FormatNumber/_internal/init.lua +8 -0
- package/runtime/FormatNumber/_internal/skeleton.lua +541 -0
- package/runtime/FormatNumber/init.lua +20 -0
- package/runtime/FormatNumber/init.luau +20 -0
- package/runtime/Fusion/Animation/ExternalTime.luau +84 -0
- package/runtime/Fusion/Animation/Spring.luau +313 -0
- package/runtime/Fusion/Animation/Stopwatch.luau +128 -0
- package/runtime/Fusion/Animation/Tween.luau +178 -0
- package/runtime/Fusion/Animation/getTweenDuration.luau +27 -0
- package/runtime/Fusion/Animation/getTweenRatio.luau +47 -0
- package/runtime/Fusion/Animation/lerpType.luau +164 -0
- package/runtime/Fusion/Animation/packType.luau +100 -0
- package/runtime/Fusion/Animation/springCoefficients.luau +80 -0
- package/runtime/Fusion/Animation/unpackType.luau +103 -0
- package/runtime/Fusion/Colour/Oklab.luau +70 -0
- package/runtime/Fusion/Colour/sRGB.luau +47 -0
- package/runtime/Fusion/External.luau +156 -0
- package/runtime/Fusion/ExternalDebug.luau +70 -0
- package/runtime/Fusion/Graph/Observer.luau +111 -0
- package/runtime/Fusion/Graph/castToGraph.luau +29 -0
- package/runtime/Fusion/Graph/change.luau +81 -0
- package/runtime/Fusion/Graph/depend.luau +33 -0
- package/runtime/Fusion/Graph/evaluate.luau +56 -0
- package/runtime/Fusion/Instances/Attribute.luau +58 -0
- package/runtime/Fusion/Instances/AttributeChange.luau +47 -0
- package/runtime/Fusion/Instances/AttributeOut.luau +63 -0
- package/runtime/Fusion/Instances/Child.luau +21 -0
- package/runtime/Fusion/Instances/Children.luau +148 -0
- package/runtime/Fusion/Instances/Hydrate.luau +29 -0
- package/runtime/Fusion/Instances/New.luau +48 -0
- package/runtime/Fusion/Instances/OnChange.luau +50 -0
- package/runtime/Fusion/Instances/OnEvent.luau +54 -0
- package/runtime/Fusion/Instances/Out.luau +69 -0
- package/runtime/Fusion/Instances/Tag.luau +61 -0
- package/runtime/Fusion/Instances/applyInstanceProps.luau +149 -0
- package/runtime/Fusion/Instances/defaultProps.luau +194 -0
- package/runtime/Fusion/LICENSE +21 -0
- package/runtime/Fusion/Logging/formatError.luau +49 -0
- package/runtime/Fusion/Logging/messages.luau +46 -0
- package/runtime/Fusion/Logging/parseError.luau +25 -0
- package/runtime/Fusion/Memory/checkLifetime.luau +134 -0
- package/runtime/Fusion/Memory/deriveScope.luau +24 -0
- package/runtime/Fusion/Memory/deriveScopeImpl.luau +40 -0
- package/runtime/Fusion/Memory/doCleanup.luau +91 -0
- package/runtime/Fusion/Memory/innerScope.luau +34 -0
- package/runtime/Fusion/Memory/insert.luau +22 -0
- package/runtime/Fusion/Memory/needsDestruction.luau +17 -0
- package/runtime/Fusion/Memory/scoped.luau +24 -0
- package/runtime/Fusion/RobloxExternal.luau +98 -0
- package/runtime/Fusion/State/Computed.luau +122 -0
- package/runtime/Fusion/State/For/Disassembly.luau +207 -0
- package/runtime/Fusion/State/For/ForTypes.luau +30 -0
- package/runtime/Fusion/State/For/init.luau +101 -0
- package/runtime/Fusion/State/ForKeys.luau +88 -0
- package/runtime/Fusion/State/ForPairs.luau +91 -0
- package/runtime/Fusion/State/ForValues.luau +88 -0
- package/runtime/Fusion/State/Value.luau +76 -0
- package/runtime/Fusion/State/castToState.luau +26 -0
- package/runtime/Fusion/State/peek.luau +31 -0
- package/runtime/Fusion/State/updateAll.luau +1 -0
- package/runtime/Fusion/Types.luau +318 -0
- package/runtime/Fusion/Utility/Contextual.luau +91 -0
- package/runtime/Fusion/Utility/Safe.luau +23 -0
- package/runtime/Fusion/Utility/isSimilar.luau +29 -0
- package/runtime/Fusion/Utility/merge.luau +35 -0
- package/runtime/Fusion/Utility/nameOf.luau +35 -0
- package/runtime/Fusion/Utility/never.luau +14 -0
- package/runtime/Fusion/Utility/nicknames.luau +11 -0
- package/runtime/Fusion/Utility/xtypeof.luau +27 -0
- package/runtime/Fusion/_impl/Animation/ExternalTime.luau +84 -0
- package/runtime/Fusion/_impl/Animation/Spring.luau +313 -0
- package/runtime/Fusion/_impl/Animation/Stopwatch.luau +128 -0
- package/runtime/Fusion/_impl/Animation/Tween.luau +178 -0
- package/runtime/Fusion/_impl/Animation/getTweenDuration.luau +27 -0
- package/runtime/Fusion/_impl/Animation/getTweenRatio.luau +47 -0
- package/runtime/Fusion/_impl/Animation/lerpType.luau +164 -0
- package/runtime/Fusion/_impl/Animation/packType.luau +100 -0
- package/runtime/Fusion/_impl/Animation/springCoefficients.luau +80 -0
- package/runtime/Fusion/_impl/Animation/unpackType.luau +103 -0
- package/runtime/Fusion/_impl/Colour/Oklab.luau +70 -0
- package/runtime/Fusion/_impl/Colour/sRGB.luau +47 -0
- package/runtime/Fusion/_impl/External.luau +156 -0
- package/runtime/Fusion/_impl/ExternalDebug.luau +70 -0
- package/runtime/Fusion/_impl/Graph/Observer.luau +111 -0
- package/runtime/Fusion/_impl/Graph/castToGraph.luau +29 -0
- package/runtime/Fusion/_impl/Graph/change.luau +81 -0
- package/runtime/Fusion/_impl/Graph/depend.luau +33 -0
- package/runtime/Fusion/_impl/Graph/evaluate.luau +56 -0
- package/runtime/Fusion/_impl/Instances/Attribute.luau +58 -0
- package/runtime/Fusion/_impl/Instances/AttributeChange.luau +47 -0
- package/runtime/Fusion/_impl/Instances/AttributeOut.luau +63 -0
- package/runtime/Fusion/_impl/Instances/Child.luau +21 -0
- package/runtime/Fusion/_impl/Instances/Children.luau +148 -0
- package/runtime/Fusion/_impl/Instances/Hydrate.luau +29 -0
- package/runtime/Fusion/_impl/Instances/New.luau +48 -0
- package/runtime/Fusion/_impl/Instances/OnChange.luau +50 -0
- package/runtime/Fusion/_impl/Instances/OnEvent.luau +54 -0
- package/runtime/Fusion/_impl/Instances/Out.luau +69 -0
- package/runtime/Fusion/_impl/Instances/Tag.luau +61 -0
- package/runtime/Fusion/_impl/Instances/applyInstanceProps.luau +149 -0
- package/runtime/Fusion/_impl/Instances/defaultProps.luau +194 -0
- package/runtime/Fusion/_impl/LICENSE +21 -0
- package/runtime/Fusion/_impl/Logging/formatError.luau +49 -0
- package/runtime/Fusion/_impl/Logging/messages.luau +46 -0
- package/runtime/Fusion/_impl/Logging/parseError.luau +25 -0
- package/runtime/Fusion/_impl/Memory/checkLifetime.luau +134 -0
- package/runtime/Fusion/_impl/Memory/deriveScope.luau +24 -0
- package/runtime/Fusion/_impl/Memory/deriveScopeImpl.luau +40 -0
- package/runtime/Fusion/_impl/Memory/doCleanup.luau +91 -0
- package/runtime/Fusion/_impl/Memory/innerScope.luau +34 -0
- package/runtime/Fusion/_impl/Memory/insert.luau +22 -0
- package/runtime/Fusion/_impl/Memory/needsDestruction.luau +17 -0
- package/runtime/Fusion/_impl/Memory/scoped.luau +24 -0
- package/runtime/Fusion/_impl/RobloxExternal.luau +98 -0
- package/runtime/Fusion/_impl/State/Computed.luau +122 -0
- package/runtime/Fusion/_impl/State/For/Disassembly.luau +207 -0
- package/runtime/Fusion/_impl/State/For/ForTypes.luau +30 -0
- package/runtime/Fusion/_impl/State/For/init.luau +101 -0
- package/runtime/Fusion/_impl/State/ForKeys.luau +88 -0
- package/runtime/Fusion/_impl/State/ForPairs.luau +91 -0
- package/runtime/Fusion/_impl/State/ForValues.luau +88 -0
- package/runtime/Fusion/_impl/State/Value.luau +76 -0
- package/runtime/Fusion/_impl/State/castToState.luau +26 -0
- package/runtime/Fusion/_impl/State/peek.luau +31 -0
- package/runtime/Fusion/_impl/State/updateAll.luau +1 -0
- package/runtime/Fusion/_impl/Types.luau +318 -0
- package/runtime/Fusion/_impl/Utility/Contextual.luau +91 -0
- package/runtime/Fusion/_impl/Utility/Safe.luau +23 -0
- package/runtime/Fusion/_impl/Utility/isSimilar.luau +29 -0
- package/runtime/Fusion/_impl/Utility/merge.luau +35 -0
- package/runtime/Fusion/_impl/Utility/nameOf.luau +35 -0
- package/runtime/Fusion/_impl/Utility/never.luau +14 -0
- package/runtime/Fusion/_impl/Utility/nicknames.luau +11 -0
- package/runtime/Fusion/_impl/Utility/xtypeof.luau +27 -0
- package/runtime/Fusion/_impl/init.luau +83 -0
- package/runtime/Fusion/init.luau +27 -0
- package/runtime/Iris/API.lua +2085 -0
- package/runtime/Iris/Internal.lua +895 -0
- package/runtime/Iris/LICENSE.txt +21 -0
- package/runtime/Iris/PubTypes.lua +43 -0
- package/runtime/Iris/Types.lua +660 -0
- package/runtime/Iris/WidgetTypes.lua +521 -0
- package/runtime/Iris/_impl/API.lua +2085 -0
- package/runtime/Iris/_impl/Internal.lua +895 -0
- package/runtime/Iris/_impl/LICENSE.txt +21 -0
- package/runtime/Iris/_impl/PubTypes.lua +43 -0
- package/runtime/Iris/_impl/Types.lua +660 -0
- package/runtime/Iris/_impl/WidgetTypes.lua +521 -0
- package/runtime/Iris/_impl/config.lua +305 -0
- package/runtime/Iris/_impl/init.lua +696 -0
- package/runtime/Iris/_impl/widgets/Button.lua +90 -0
- package/runtime/Iris/_impl/widgets/Checkbox.lua +115 -0
- package/runtime/Iris/_impl/widgets/Combo.lua +492 -0
- package/runtime/Iris/_impl/widgets/Format.lua +140 -0
- package/runtime/Iris/_impl/widgets/Image.lua +155 -0
- package/runtime/Iris/_impl/widgets/Input.lua +1232 -0
- package/runtime/Iris/_impl/widgets/Menu.lua +599 -0
- package/runtime/Iris/_impl/widgets/Plot.lua +639 -0
- package/runtime/Iris/_impl/widgets/RadioButton.lua +126 -0
- package/runtime/Iris/_impl/widgets/Root.lua +143 -0
- package/runtime/Iris/_impl/widgets/Tab.lua +333 -0
- package/runtime/Iris/_impl/widgets/Table.lua +635 -0
- package/runtime/Iris/_impl/widgets/Text.lua +132 -0
- package/runtime/Iris/_impl/widgets/Tree.lua +287 -0
- package/runtime/Iris/_impl/widgets/Window.lua +1075 -0
- package/runtime/Iris/_impl/widgets/init.lua +447 -0
- package/runtime/Iris/config.lua +305 -0
- package/runtime/Iris/init.lua +696 -0
- package/runtime/Iris/init.luau +12 -0
- package/runtime/Iris/widgets/Button.lua +90 -0
- package/runtime/Iris/widgets/Checkbox.lua +115 -0
- package/runtime/Iris/widgets/Combo.lua +492 -0
- package/runtime/Iris/widgets/Format.lua +140 -0
- package/runtime/Iris/widgets/Image.lua +155 -0
- package/runtime/Iris/widgets/Input.lua +1232 -0
- package/runtime/Iris/widgets/Menu.lua +599 -0
- package/runtime/Iris/widgets/Plot.lua +639 -0
- package/runtime/Iris/widgets/RadioButton.lua +126 -0
- package/runtime/Iris/widgets/Root.lua +143 -0
- package/runtime/Iris/widgets/Tab.lua +333 -0
- package/runtime/Iris/widgets/Table.lua +635 -0
- package/runtime/Iris/widgets/Text.lua +132 -0
- package/runtime/Iris/widgets/Tree.lua +287 -0
- package/runtime/Iris/widgets/Window.lua +1075 -0
- package/runtime/Iris/widgets/init.lua +447 -0
- package/runtime/Janitor/FastDefer.luau +33 -0
- package/runtime/Janitor/LICENSE +21 -0
- package/runtime/Janitor/_impl/FastDefer.luau +33 -0
- package/runtime/Janitor/_impl/LICENSE +21 -0
- package/runtime/Janitor/_impl/init.luau +999 -0
- package/runtime/Janitor/init.luau +45 -0
- package/runtime/MathUtils/init.luau +100 -0
- package/runtime/Module3D/LICENSE +21 -0
- package/runtime/Module3D/_impl/LICENSE +21 -0
- package/runtime/Module3D/_impl/init.luau +269 -0
- package/runtime/Module3D/init.luau +14 -0
- package/runtime/Net/init.luau +125 -0
- package/runtime/Net/src/codec.luau +153 -0
- package/runtime/Occlude/init.luau +54 -0
- package/runtime/Promise/LICENSE +21 -0
- package/runtime/Promise/_impl/LICENSE +21 -0
- package/runtime/Promise/_impl/init.lua +1991 -0
- package/runtime/Promise/init.lua +1990 -0
- package/runtime/Promise/init.luau +13 -0
- package/runtime/Promise/types.luau +46 -0
- package/runtime/SOURCES.md +22 -0
- package/runtime/Spring/LICENSE +201 -0
- package/runtime/Spring/_impl/LICENSE +201 -0
- package/runtime/Spring/_impl/init.luau +111 -0
- package/runtime/Spring/init.luau +24 -0
- package/runtime/StateMachine/Classes/State.lua +375 -0
- package/runtime/StateMachine/Classes/Transition.lua +336 -0
- package/runtime/StateMachine/Functions/deepCopy.lua +19 -0
- package/runtime/StateMachine/Functions/mergeTables.lua +22 -0
- package/runtime/StateMachine/LICENSE +19 -0
- package/runtime/StateMachine/Vendor/Signal.lua +386 -0
- package/runtime/StateMachine/Vendor/Trove.lua +188 -0
- package/runtime/StateMachine/_impl/Classes/State.lua +375 -0
- package/runtime/StateMachine/_impl/Classes/Transition.lua +336 -0
- package/runtime/StateMachine/_impl/Functions/deepCopy.lua +19 -0
- package/runtime/StateMachine/_impl/Functions/mergeTables.lua +22 -0
- package/runtime/StateMachine/_impl/LICENSE +19 -0
- package/runtime/StateMachine/_impl/Vendor/Signal.lua +386 -0
- package/runtime/StateMachine/_impl/Vendor/Trove.lua +188 -0
- package/runtime/StateMachine/_impl/init.lua +595 -0
- package/runtime/StateMachine/init.lua +595 -0
- package/runtime/StateMachine/init.luau +10 -0
- package/runtime/StickyBillboard/init.luau +167 -0
- package/runtime/TopbarPlus/Attribute.lua +35 -0
- package/runtime/TopbarPlus/Elements/Caption.lua +316 -0
- package/runtime/TopbarPlus/Elements/Container.lua +215 -0
- package/runtime/TopbarPlus/Elements/Dropdown.lua +315 -0
- package/runtime/TopbarPlus/Elements/Indicator.lua +91 -0
- package/runtime/TopbarPlus/Elements/Menu.lua +180 -0
- package/runtime/TopbarPlus/Elements/Notice.lua +113 -0
- package/runtime/TopbarPlus/Elements/Selection.lua +49 -0
- package/runtime/TopbarPlus/Elements/Widget.lua +437 -0
- package/runtime/TopbarPlus/Features/Gamepad.lua +201 -0
- package/runtime/TopbarPlus/Features/Overflow.lua +360 -0
- package/runtime/TopbarPlus/Features/Themes/Classic.lua +27 -0
- package/runtime/TopbarPlus/Features/Themes/Default.lua +75 -0
- package/runtime/TopbarPlus/Features/Themes/init.lua +353 -0
- package/runtime/TopbarPlus/LICENSE +381 -0
- package/runtime/TopbarPlus/Packages/GoodSignal.lua +182 -0
- package/runtime/TopbarPlus/Packages/Janitor.lua +322 -0
- package/runtime/TopbarPlus/Reference.lua +30 -0
- package/runtime/TopbarPlus/Types.lua +477 -0
- package/runtime/TopbarPlus/Utility.lua +462 -0
- package/runtime/TopbarPlus/VERSION.lua +51 -0
- package/runtime/TopbarPlus/_impl/Attribute.lua +35 -0
- package/runtime/TopbarPlus/_impl/Elements/Caption.lua +316 -0
- package/runtime/TopbarPlus/_impl/Elements/Container.lua +215 -0
- package/runtime/TopbarPlus/_impl/Elements/Dropdown.lua +315 -0
- package/runtime/TopbarPlus/_impl/Elements/Indicator.lua +91 -0
- package/runtime/TopbarPlus/_impl/Elements/Menu.lua +180 -0
- package/runtime/TopbarPlus/_impl/Elements/Notice.lua +113 -0
- package/runtime/TopbarPlus/_impl/Elements/Selection.lua +49 -0
- package/runtime/TopbarPlus/_impl/Elements/Widget.lua +437 -0
- package/runtime/TopbarPlus/_impl/Features/Gamepad.lua +201 -0
- package/runtime/TopbarPlus/_impl/Features/Overflow.lua +360 -0
- package/runtime/TopbarPlus/_impl/Features/Themes/Classic.lua +27 -0
- package/runtime/TopbarPlus/_impl/Features/Themes/Default.lua +75 -0
- package/runtime/TopbarPlus/_impl/Features/Themes/init.lua +353 -0
- package/runtime/TopbarPlus/_impl/LICENSE +381 -0
- package/runtime/TopbarPlus/_impl/Packages/GoodSignal.lua +182 -0
- package/runtime/TopbarPlus/_impl/Packages/Janitor.lua +322 -0
- package/runtime/TopbarPlus/_impl/Reference.lua +30 -0
- package/runtime/TopbarPlus/_impl/Types.lua +477 -0
- package/runtime/TopbarPlus/_impl/Utility.lua +462 -0
- package/runtime/TopbarPlus/_impl/VERSION.lua +51 -0
- package/runtime/TopbarPlus/_impl/init.lua +1249 -0
- package/runtime/TopbarPlus/init.lua +1249 -0
- package/runtime/TopbarPlus/init.luau +8 -0
- package/runtime/Twinkle/init.luau +157 -0
- package/runtime/VfxUtil/init.luau +164 -0
- package/src/api.generated.js +3675 -0
- package/src/api.js +57 -0
- package/src/architecture.js +393 -0
- package/src/cli.js +192 -0
- package/src/compile.js +40 -0
- package/src/emit.js +213 -0
- package/src/lex.js +149 -0
- package/src/libs.js +355 -0
- package/src/parse.js +421 -0
- package/src/preprocess.js +80 -0
- package/src/understand.js +453 -0
- package/templates/game/.clangd +5 -0
- package/templates/game/.vscode/c_cpp_properties.json +23 -0
- package/templates/game/.vscode/settings.json +12 -0
- package/templates/game/Packages/.gitkeep +0 -0
- package/templates/game/cluaupp.config.json +6 -0
- package/templates/game/compile_flags.txt +3 -0
- package/templates/game/default.project.json +39 -0
- package/templates/game/package.json +9 -0
- package/templates/game/src/client/init.client.cpp +5 -0
- package/templates/game/src/server/leaderstats.server.cpp +28 -0
- package/templates/game/src/shared/config.cpp +5 -0
- package/templates/game/src/shared/config.h +3 -0
- package/templates/game/wally.toml +11 -0
|
@@ -0,0 +1,999 @@
|
|
|
1
|
+
--!optimize 2
|
|
2
|
+
--!strict
|
|
3
|
+
|
|
4
|
+
-- Compiled with L+ C Edition
|
|
5
|
+
-- Janitor
|
|
6
|
+
-- Original by Validark
|
|
7
|
+
-- Modifications by pobammer
|
|
8
|
+
-- roblox-ts support by OverHash and Validark
|
|
9
|
+
-- LinkToInstance fixed by Elttob.
|
|
10
|
+
-- Cleanup edge cases fixed by codesenseAye.
|
|
11
|
+
|
|
12
|
+
local FastDefer = require(script.FastDefer)
|
|
13
|
+
local Promise = require(script.Parent.Parent.Promise)
|
|
14
|
+
type Promise<T...> = Promise.TypedPromise<T...>
|
|
15
|
+
|
|
16
|
+
local LinkToInstanceIndex = setmetatable({}, {
|
|
17
|
+
__tostring = function()
|
|
18
|
+
return "LinkToInstanceIndex"
|
|
19
|
+
end;
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
local INVALID_METHOD_NAME =
|
|
23
|
+
"Object is a %* and as such expected `true?` for the method name and instead got %*. Traceback: %*"
|
|
24
|
+
local METHOD_NOT_FOUND_ERROR = "Object %* doesn't have method %*, are you sure you want to add it? Traceback: %*"
|
|
25
|
+
local NOT_A_PROMISE = "Invalid argument #1 to 'Janitor:AddPromise' (Promise expected, got %* (%*)) Traceback: %*"
|
|
26
|
+
|
|
27
|
+
export type Janitor = typeof(setmetatable({} :: {
|
|
28
|
+
CurrentlyCleaning: boolean,
|
|
29
|
+
SuppressInstanceReDestroy: boolean,
|
|
30
|
+
UnsafeThreadCleanup: boolean,
|
|
31
|
+
|
|
32
|
+
Add: <T>(self: Janitor, object: T, methodName: BooleanOrString?, index: any?) -> T,
|
|
33
|
+
AddObject: <T, A...>(
|
|
34
|
+
self: Janitor,
|
|
35
|
+
constructor: {new: (A...) -> T},
|
|
36
|
+
methodName: BooleanOrString?,
|
|
37
|
+
index: any?,
|
|
38
|
+
A...
|
|
39
|
+
) -> T,
|
|
40
|
+
AddPromise: <T...>(self: Janitor, promiseObject: Promise<T...>, index: unknown?) -> Promise<T...>,
|
|
41
|
+
|
|
42
|
+
Remove: (self: Janitor, index: any) -> Janitor,
|
|
43
|
+
RemoveNoClean: (self: Janitor, index: any) -> Janitor,
|
|
44
|
+
|
|
45
|
+
RemoveList: (self: Janitor, ...any) -> Janitor,
|
|
46
|
+
RemoveListNoClean: (self: Janitor, ...any) -> Janitor,
|
|
47
|
+
|
|
48
|
+
Get: (self: Janitor, index: any) -> any?,
|
|
49
|
+
GetAll: (self: Janitor) -> {[any]: any},
|
|
50
|
+
|
|
51
|
+
Cleanup: (self: Janitor) -> (),
|
|
52
|
+
Destroy: (self: Janitor) -> (),
|
|
53
|
+
|
|
54
|
+
LinkToInstance: (self: Janitor, Object: Instance, allowMultiple: boolean?) -> RBXScriptConnection,
|
|
55
|
+
LinkToInstances: (self: Janitor, ...Instance) -> Janitor,
|
|
56
|
+
}, {} :: {__call: (self: Janitor) -> ()}))
|
|
57
|
+
type Private = typeof(setmetatable({} :: {
|
|
58
|
+
CurrentlyCleaning: boolean,
|
|
59
|
+
SuppressInstanceReDestroy: boolean,
|
|
60
|
+
UnsafeThreadCleanup: boolean,
|
|
61
|
+
|
|
62
|
+
-- Private
|
|
63
|
+
[any]: BooleanOrString,
|
|
64
|
+
|
|
65
|
+
Add: <T>(self: Private, object: T, methodName: BooleanOrString?, index: any?) -> T,
|
|
66
|
+
AddObject: <T, A...>(
|
|
67
|
+
self: Private,
|
|
68
|
+
constructor: {new: (A...) -> T},
|
|
69
|
+
methodName: BooleanOrString?,
|
|
70
|
+
index: any?,
|
|
71
|
+
A...
|
|
72
|
+
) -> T,
|
|
73
|
+
AddPromise: <T...>(self: Private, promiseObject: Promise<T...>, index: unknown?) -> Promise<T...>,
|
|
74
|
+
|
|
75
|
+
Remove: (self: Private, index: any) -> Private,
|
|
76
|
+
RemoveNoClean: (self: Private, index: any) -> Private,
|
|
77
|
+
|
|
78
|
+
RemoveList: (self: Private, ...any) -> Private,
|
|
79
|
+
RemoveListNoClean: (self: Private, ...any) -> Private,
|
|
80
|
+
|
|
81
|
+
Get: (self: Private, index: any) -> any?,
|
|
82
|
+
GetAll: (self: Private) -> {[any]: any},
|
|
83
|
+
|
|
84
|
+
Cleanup: (self: Private) -> (),
|
|
85
|
+
Destroy: (self: Private) -> (),
|
|
86
|
+
|
|
87
|
+
LinkToInstance: (self: Private, object: Instance, allowMultiple: boolean?) -> RBXScriptConnection,
|
|
88
|
+
LinkToInstances: (self: Private, ...Instance) -> Private,
|
|
89
|
+
}, {} :: {__call: (self: Private) -> ()}))
|
|
90
|
+
type Static = {
|
|
91
|
+
ClassName: "Janitor",
|
|
92
|
+
|
|
93
|
+
CurrentlyCleaning: boolean,
|
|
94
|
+
SuppressInstanceReDestroy: boolean,
|
|
95
|
+
UnsafeThreadCleanup: boolean,
|
|
96
|
+
|
|
97
|
+
new: () -> Janitor,
|
|
98
|
+
Is: (object: any) -> boolean,
|
|
99
|
+
instanceof: (object: any) -> boolean,
|
|
100
|
+
}
|
|
101
|
+
type PrivateStatic = Static & {
|
|
102
|
+
__call: (self: Private) -> (),
|
|
103
|
+
__tostring: (self: Private) -> string,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
--[=[
|
|
107
|
+
Janitor is a light-weight, flexible object for cleaning up connections,
|
|
108
|
+
instances, or anything. This implementation covers all use cases, as it
|
|
109
|
+
doesn't force you to rely on naive typechecking to guess how an instance
|
|
110
|
+
should be cleaned up. Instead, the developer may specify any behavior for
|
|
111
|
+
any object.
|
|
112
|
+
|
|
113
|
+
This is the fastest OOP library on Roblox of its kind on both X86-64 as
|
|
114
|
+
well as ARM64.
|
|
115
|
+
|
|
116
|
+
@class Janitor
|
|
117
|
+
]=]
|
|
118
|
+
local Janitor = {} :: Janitor & Static
|
|
119
|
+
local Private = Janitor :: Private & PrivateStatic
|
|
120
|
+
Janitor.ClassName = "Janitor"
|
|
121
|
+
Janitor.CurrentlyCleaning = true
|
|
122
|
+
Janitor.SuppressInstanceReDestroy = false
|
|
123
|
+
Janitor.UnsafeThreadCleanup = false;
|
|
124
|
+
(Janitor :: any).__index = Janitor
|
|
125
|
+
|
|
126
|
+
local Janitors = setmetatable({} :: {[Private]: {[any]: any}}, {__mode = "ks"})
|
|
127
|
+
|
|
128
|
+
--[=[
|
|
129
|
+
Whether or not the Janitor is currently cleaning up.
|
|
130
|
+
@readonly
|
|
131
|
+
@prop CurrentlyCleaning boolean
|
|
132
|
+
@within Janitor
|
|
133
|
+
]=]
|
|
134
|
+
--[=[
|
|
135
|
+
Whether or not you want to suppress the re-destroying of instances. Default
|
|
136
|
+
is false, which is the original behavior.
|
|
137
|
+
|
|
138
|
+
@since 1.15.4
|
|
139
|
+
@prop SuppressInstanceReDestroy boolean
|
|
140
|
+
@within Janitor
|
|
141
|
+
]=]
|
|
142
|
+
--[=[
|
|
143
|
+
Whether or not to use the unsafe fast defer function for cleaning up
|
|
144
|
+
threads. This might be able to throw, so be careful. If you're getting any
|
|
145
|
+
thread related errors, chances are it is this.
|
|
146
|
+
|
|
147
|
+
@since 1.18.0
|
|
148
|
+
@prop UnsafeThreadCleanup boolean
|
|
149
|
+
@within Janitor
|
|
150
|
+
]=]
|
|
151
|
+
|
|
152
|
+
local TYPE_DEFAULTS = {
|
|
153
|
+
["function"] = true;
|
|
154
|
+
thread = true;
|
|
155
|
+
RBXScriptConnection = "Disconnect";
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
--[=[
|
|
159
|
+
Instantiates a new Janitor object.
|
|
160
|
+
@return Janitor
|
|
161
|
+
]=]
|
|
162
|
+
function Janitor.new(): Janitor
|
|
163
|
+
return setmetatable({
|
|
164
|
+
CurrentlyCleaning = false;
|
|
165
|
+
}, Janitor) :: never
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
--[=[
|
|
169
|
+
Determines if the passed object is a Janitor. This checks the metatable
|
|
170
|
+
directly.
|
|
171
|
+
|
|
172
|
+
@param object unknown -- The object you are checking.
|
|
173
|
+
@return boolean -- `true` if `object` is a Janitor.
|
|
174
|
+
]=]
|
|
175
|
+
function Janitor.Is(object: any): boolean
|
|
176
|
+
return type(object) == "table" and getmetatable(object) == Janitor
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
--[=[
|
|
180
|
+
An alias for [Janitor.Is]. This is intended for roblox-ts support.
|
|
181
|
+
|
|
182
|
+
@function instanceof
|
|
183
|
+
@within Janitor
|
|
184
|
+
|
|
185
|
+
@param object unknown -- The object you are checking.
|
|
186
|
+
@return boolean -- `true` if `object` is a Janitor.
|
|
187
|
+
]=]
|
|
188
|
+
Janitor.instanceof = Janitor.Is
|
|
189
|
+
|
|
190
|
+
local Destroy = game.Destroy
|
|
191
|
+
|
|
192
|
+
-- very cheeky optimization
|
|
193
|
+
local function Remove(self: Private, index: any): Janitor
|
|
194
|
+
local this = Janitors[self]
|
|
195
|
+
|
|
196
|
+
if this then
|
|
197
|
+
local object = this[index]
|
|
198
|
+
if not object then
|
|
199
|
+
return self
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
local methodName = self[object]
|
|
203
|
+
if methodName then
|
|
204
|
+
if methodName == true then
|
|
205
|
+
if type(object) == "function" then
|
|
206
|
+
object()
|
|
207
|
+
else
|
|
208
|
+
local wasCancelled: boolean? = nil
|
|
209
|
+
if coroutine.running() ~= object then
|
|
210
|
+
wasCancelled = pcall(function()
|
|
211
|
+
task.cancel(object)
|
|
212
|
+
end)
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
if not wasCancelled then
|
|
216
|
+
local toCleanup = object
|
|
217
|
+
if self.UnsafeThreadCleanup then
|
|
218
|
+
FastDefer(function()
|
|
219
|
+
task.cancel(toCleanup)
|
|
220
|
+
end)
|
|
221
|
+
else
|
|
222
|
+
task.defer(function()
|
|
223
|
+
task.cancel(toCleanup)
|
|
224
|
+
end)
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
else
|
|
229
|
+
if methodName == "Destroy" then
|
|
230
|
+
if self.SuppressInstanceReDestroy and typeof(object) == "Instance" then
|
|
231
|
+
pcall(Destroy, object)
|
|
232
|
+
else
|
|
233
|
+
local destroy = object.Destroy
|
|
234
|
+
if destroy then
|
|
235
|
+
destroy(object)
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
elseif methodName == "Disconnect" then
|
|
239
|
+
local disconnect = object.Disconnect
|
|
240
|
+
if disconnect then
|
|
241
|
+
disconnect(object)
|
|
242
|
+
end
|
|
243
|
+
else
|
|
244
|
+
local objectMethod = (object :: never)[methodName] :: (object: unknown) -> ()
|
|
245
|
+
if objectMethod then
|
|
246
|
+
objectMethod(object)
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
self[object] = nil
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
this[index] = nil
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
return self
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
type BooleanOrString = boolean | string
|
|
261
|
+
|
|
262
|
+
local function Add<T>(self: Private, object: T, methodName: BooleanOrString?, index: any?): T
|
|
263
|
+
if index then
|
|
264
|
+
Remove(self, index)
|
|
265
|
+
|
|
266
|
+
local this = Janitors[self]
|
|
267
|
+
if not this then
|
|
268
|
+
this = {}
|
|
269
|
+
Janitors[self] = this
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
this[index] = object
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
local typeOf = typeof(object)
|
|
276
|
+
local newMethodName = methodName or TYPE_DEFAULTS[typeOf] or "Destroy"
|
|
277
|
+
|
|
278
|
+
if typeOf == "function" or typeOf == "thread" then
|
|
279
|
+
if newMethodName ~= true then
|
|
280
|
+
warn(string.format(INVALID_METHOD_NAME, typeOf, tostring(newMethodName), debug.traceback(nil, 2)))
|
|
281
|
+
end
|
|
282
|
+
else
|
|
283
|
+
if not (object :: never)[newMethodName] then
|
|
284
|
+
warn(
|
|
285
|
+
string.format(
|
|
286
|
+
METHOD_NOT_FOUND_ERROR,
|
|
287
|
+
tostring(object),
|
|
288
|
+
tostring(newMethodName),
|
|
289
|
+
debug.traceback(nil, 2)
|
|
290
|
+
)
|
|
291
|
+
)
|
|
292
|
+
end
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
self[object] = newMethodName
|
|
296
|
+
return object
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
--[=[
|
|
300
|
+
Adds an `object` to Janitor for later cleanup, where `methodName` is the
|
|
301
|
+
key of the method within `object` which should be called at cleanup time.
|
|
302
|
+
If the `methodName` is `true` the `object` itself will be called if it's a
|
|
303
|
+
function or have `task.cancel` called on it if it is a thread. If passed an
|
|
304
|
+
index it will occupy a namespace which can be `Remove()`d or overwritten.
|
|
305
|
+
Returns the `object`.
|
|
306
|
+
|
|
307
|
+
:::info Note
|
|
308
|
+
Objects not given an explicit `methodName` will be passed into the `typeof`
|
|
309
|
+
function for a very naive typecheck. RBXConnections will be assigned to
|
|
310
|
+
"Disconnect", functions and threads will be assigned to `true`, and
|
|
311
|
+
everything else will default to "Destroy". Not recommended, but hey, you do
|
|
312
|
+
you.
|
|
313
|
+
:::
|
|
314
|
+
|
|
315
|
+
### Luau:
|
|
316
|
+
|
|
317
|
+
```lua
|
|
318
|
+
local Workspace = game:GetService("Workspace")
|
|
319
|
+
local TweenService = game:GetService("TweenService")
|
|
320
|
+
|
|
321
|
+
local obliterator = Janitor.new()
|
|
322
|
+
local part = Workspace:FindFirstChild("Part") :: Part
|
|
323
|
+
|
|
324
|
+
-- Queue the Part to be Destroyed at Cleanup time
|
|
325
|
+
obliterator:Add(part, "Destroy")
|
|
326
|
+
|
|
327
|
+
-- Queue function to be called with `true` methodName
|
|
328
|
+
obliterator:Add(print, true)
|
|
329
|
+
|
|
330
|
+
-- Close a thread.
|
|
331
|
+
obliterator:Add(task.defer(function()
|
|
332
|
+
while true do
|
|
333
|
+
print("Running!")
|
|
334
|
+
task.wait(0.5)
|
|
335
|
+
end
|
|
336
|
+
end), true)
|
|
337
|
+
|
|
338
|
+
-- This implementation allows you to specify behavior for any object
|
|
339
|
+
obliterator:Add(TweenService:Create(part, TweenInfo.new(1), {Size = Vector3.one}), "Cancel")
|
|
340
|
+
|
|
341
|
+
-- By passing an index, the object will occupy a namespace
|
|
342
|
+
-- If "CurrentTween" already exists, it will call :Remove("CurrentTween") before writing
|
|
343
|
+
obliterator:Add(TweenService:Create(part, TweenInfo.new(1), {Size = Vector3.one}), "Destroy", "CurrentTween")
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### TypeScript:
|
|
347
|
+
|
|
348
|
+
```ts
|
|
349
|
+
import { Workspace, TweenService } from "@rbxts/services";
|
|
350
|
+
import { Janitor } from "@rbxts/janitor";
|
|
351
|
+
|
|
352
|
+
const obliterator = new Janitor<{ CurrentTween: Tween }>();
|
|
353
|
+
const part = Workspace.FindFirstChild("Part") as Part;
|
|
354
|
+
|
|
355
|
+
// Queue the part to be Destroyed at Cleanup time
|
|
356
|
+
obliterator.Add(part, "Destroy");
|
|
357
|
+
|
|
358
|
+
// Queue function to be called with `true` methodName
|
|
359
|
+
obliterator.Add(print, true);
|
|
360
|
+
|
|
361
|
+
// Close a thread.
|
|
362
|
+
obliterator.Add(task.defer(() => {
|
|
363
|
+
while (true) {
|
|
364
|
+
print("Running!");
|
|
365
|
+
task.wait(0.5);
|
|
366
|
+
}
|
|
367
|
+
}), true);
|
|
368
|
+
|
|
369
|
+
// This implementation allows you to specify behavior for any object
|
|
370
|
+
obliterator.Add(TweenService.Create(part, new TweenInfo(1), { Size: Vector3.one }), "Cancel");
|
|
371
|
+
|
|
372
|
+
// By passing an index, the object will occupy a namespace
|
|
373
|
+
// If "CurrentTween" already exists, it will call :Remove("CurrentTween") before writing
|
|
374
|
+
obliterator.Add(TweenService.Create(part, new TweenInfo(1), { Size: Vector3.one }), "Destroy", "CurrentTween");
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
@method Add
|
|
378
|
+
@within Janitor
|
|
379
|
+
|
|
380
|
+
@param object T -- The object you want to clean up.
|
|
381
|
+
@param methodName? boolean | string -- The name of the method that will be used to clean up. If not passed, it will first check if the object's type exists in TypeDefaults, and if that doesn't exist, it assumes `Destroy`.
|
|
382
|
+
@param index? unknown -- The index that can be used to clean up the object manually.
|
|
383
|
+
@return T -- The object that was passed as the first argument.
|
|
384
|
+
]=]
|
|
385
|
+
Private.Add = Add
|
|
386
|
+
|
|
387
|
+
--[=[
|
|
388
|
+
Constructs an object for you and adds it to the Janitor. It's really just
|
|
389
|
+
shorthand for `Janitor:Add(object.new(), methodName, index)`.
|
|
390
|
+
|
|
391
|
+
### Luau:
|
|
392
|
+
|
|
393
|
+
```lua
|
|
394
|
+
local obliterator = Janitor.new()
|
|
395
|
+
local subObliterator = obliterator:AddObject(Janitor, "Destroy")
|
|
396
|
+
-- subObliterator is another Janitor!
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### TypeScript:
|
|
400
|
+
|
|
401
|
+
```ts
|
|
402
|
+
import { Janitor } from "@rbxts/janitor";
|
|
403
|
+
|
|
404
|
+
const obliterator = new Janitor();
|
|
405
|
+
const subObliterator = obliterator.AddObject(Janitor, "Destroy");
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
@since v1.16.0
|
|
409
|
+
@param constructor {new: (A...) -> T} -- The constructor for the object you want to add to the Janitor.
|
|
410
|
+
@param methodName? boolean | string -- The name of the method that will be used to clean up. If not passed, it will first check if the object's type exists in TypeDefaults, and if that doesn't exist, it assumes `Destroy`.
|
|
411
|
+
@param index? unknown -- The index that can be used to clean up the object manually.
|
|
412
|
+
@param ... A... -- The arguments that will be passed to the constructor.
|
|
413
|
+
@return T -- The object that was passed as the first argument.
|
|
414
|
+
]=]
|
|
415
|
+
function Janitor:AddObject<T, A...>(constructor: {new: (A...) -> T}, methodName: BooleanOrString?, index: any?, ...: A...): T
|
|
416
|
+
return Add(self, constructor.new(...), methodName, index)
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
local function Get(self: Private, index: unknown): any?
|
|
420
|
+
local this = Janitors[self]
|
|
421
|
+
return if this then this[index] else nil
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
--[=[
|
|
425
|
+
Gets whatever object is stored with the given index, if it exists. This was
|
|
426
|
+
added since Maid allows getting the task using `__index`.
|
|
427
|
+
|
|
428
|
+
### Luau:
|
|
429
|
+
|
|
430
|
+
```lua
|
|
431
|
+
local obliterator = Janitor.new()
|
|
432
|
+
obliterator:Add(Workspace.Baseplate, "Destroy", "Baseplate")
|
|
433
|
+
print(obliterator:Get("Baseplate")) -- Returns Baseplate.
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### TypeScript:
|
|
437
|
+
|
|
438
|
+
```ts
|
|
439
|
+
import { Workspace } from "@rbxts/services";
|
|
440
|
+
import { Janitor } from "@rbxts/janitor";
|
|
441
|
+
|
|
442
|
+
const obliterator = new Janitor<{ Baseplate: Part }>();
|
|
443
|
+
obliterator.Add(Workspace.FindFirstChild("Baseplate") as Part, "Destroy", "Baseplate");
|
|
444
|
+
print(obliterator.Get("Baseplate")); // Returns Baseplate.
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
@method Get
|
|
448
|
+
@within Janitor
|
|
449
|
+
|
|
450
|
+
@param index unknown -- The index that the object is stored under.
|
|
451
|
+
@return unknown? -- This will return the object if it is found, but it won't return anything if it doesn't exist.
|
|
452
|
+
]=]
|
|
453
|
+
Janitor.Get = Get
|
|
454
|
+
|
|
455
|
+
--[=[
|
|
456
|
+
Adds a [Promise](https://github.com/evaera/roblox-lua-promise) to the
|
|
457
|
+
Janitor. If the Janitor is cleaned up and the Promise is not completed, the
|
|
458
|
+
Promise will be cancelled.
|
|
459
|
+
|
|
460
|
+
### Luau:
|
|
461
|
+
|
|
462
|
+
```lua
|
|
463
|
+
local obliterator = Janitor.new()
|
|
464
|
+
obliterator:AddPromise(Promise.delay(3)):andThenCall(print, "Finished!"):catch(warn)
|
|
465
|
+
task.wait(1)
|
|
466
|
+
obliterator:Cleanup()
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### TypeScript:
|
|
470
|
+
|
|
471
|
+
```ts
|
|
472
|
+
import { Janitor } from "@rbxts/janitor";
|
|
473
|
+
|
|
474
|
+
const obliterator = new Janitor();
|
|
475
|
+
obliterator.AddPromise(Promise.delay(3)).andThenCall(print, "Finished!").catch(warn);
|
|
476
|
+
task.wait(1);
|
|
477
|
+
obliterator.Cleanup();
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
@error NotAPromiseError -- Thrown if the promise is not a Promise.
|
|
481
|
+
|
|
482
|
+
@param promiseObject Promise -- The promise you want to add to the Janitor.
|
|
483
|
+
@param index? unknown -- The index that can be used to clean up the object manually.
|
|
484
|
+
@return Promise
|
|
485
|
+
]=]
|
|
486
|
+
function Janitor:AddPromise<T...>(promiseObject: Promise<T...>, index: unknown?): Promise<T...>
|
|
487
|
+
if not Promise then
|
|
488
|
+
return promiseObject
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
if not Promise.is(promiseObject) then
|
|
492
|
+
error(string.format(NOT_A_PROMISE, typeof(promiseObject), tostring(promiseObject), debug.traceback(nil, 2)))
|
|
493
|
+
end
|
|
494
|
+
|
|
495
|
+
if promiseObject:getStatus() ~= Promise.Status.Started then
|
|
496
|
+
return promiseObject
|
|
497
|
+
end
|
|
498
|
+
|
|
499
|
+
local uniqueId = index
|
|
500
|
+
if uniqueId == nil then
|
|
501
|
+
uniqueId = newproxy(false)
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
local newPromise = Add(self, Promise.new(function(resolve, _, onCancel)
|
|
505
|
+
if onCancel(function()
|
|
506
|
+
promiseObject:cancel()
|
|
507
|
+
end) then
|
|
508
|
+
return
|
|
509
|
+
end
|
|
510
|
+
|
|
511
|
+
resolve(promiseObject)
|
|
512
|
+
end), "cancel", uniqueId)
|
|
513
|
+
|
|
514
|
+
newPromise:finally(function()
|
|
515
|
+
if Get(self, uniqueId) == newPromise then
|
|
516
|
+
Remove(self, uniqueId)
|
|
517
|
+
end
|
|
518
|
+
end)
|
|
519
|
+
|
|
520
|
+
return newPromise :: never
|
|
521
|
+
end
|
|
522
|
+
|
|
523
|
+
--[=[
|
|
524
|
+
Cleans up whatever `Object` was set to this namespace by the 3rd parameter of [Janitor.Add](#Add).
|
|
525
|
+
|
|
526
|
+
### Luau:
|
|
527
|
+
|
|
528
|
+
```lua
|
|
529
|
+
local obliterator = Janitor.new()
|
|
530
|
+
obliterator:Add(workspace.Baseplate, "Destroy", "Baseplate")
|
|
531
|
+
obliterator:Remove("Baseplate")
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
### TypeScript:
|
|
535
|
+
|
|
536
|
+
```ts
|
|
537
|
+
import { Workspace } from "@rbxts/services";
|
|
538
|
+
import { Janitor } from "@rbxts/janitor";
|
|
539
|
+
|
|
540
|
+
const obliterator = new Janitor<{ Baseplate: Part }>();
|
|
541
|
+
obliterator.Add(Workspace.FindFirstChild("Baseplate") as Part, "Destroy", "Baseplate");
|
|
542
|
+
obliterator.Remove("Baseplate");
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
@method Remove
|
|
546
|
+
@within Janitor
|
|
547
|
+
|
|
548
|
+
@param index unknown -- The index you want to remove.
|
|
549
|
+
@return Janitor
|
|
550
|
+
]=]
|
|
551
|
+
Private.Remove = Remove
|
|
552
|
+
|
|
553
|
+
--[=[
|
|
554
|
+
Removes an object from the Janitor without running a cleanup.
|
|
555
|
+
|
|
556
|
+
### Luau
|
|
557
|
+
|
|
558
|
+
```lua
|
|
559
|
+
local obliterator = Janitor.new()
|
|
560
|
+
obliterator:Add(function()
|
|
561
|
+
print("Removed!")
|
|
562
|
+
end, true, "Function")
|
|
563
|
+
|
|
564
|
+
obliterator:RemoveNoClean("Function") -- Does not print.
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### TypeScript:
|
|
568
|
+
|
|
569
|
+
```ts
|
|
570
|
+
import { Janitor } from "@rbxts/janitor";
|
|
571
|
+
|
|
572
|
+
const obliterator = new Janitor<{ Function: () => void }>();
|
|
573
|
+
obliterator.Add(() => print("Removed!"), true, "Function");
|
|
574
|
+
|
|
575
|
+
obliterator.RemoveNoClean("Function"); // Does not print.
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
@method RemoveNoClean
|
|
579
|
+
@within Janitor
|
|
580
|
+
|
|
581
|
+
@since v1.15.0
|
|
582
|
+
@param index unknown -- The index you are removing.
|
|
583
|
+
@return Janitor
|
|
584
|
+
]=]
|
|
585
|
+
function Private:RemoveNoClean(index: any): Janitor
|
|
586
|
+
local this = Janitors[self]
|
|
587
|
+
|
|
588
|
+
if this then
|
|
589
|
+
local object = this[index]
|
|
590
|
+
if object then
|
|
591
|
+
self[object] = nil
|
|
592
|
+
this[index] = nil
|
|
593
|
+
end
|
|
594
|
+
end
|
|
595
|
+
|
|
596
|
+
return self
|
|
597
|
+
end
|
|
598
|
+
|
|
599
|
+
--[=[
|
|
600
|
+
Cleans up multiple objects at once.
|
|
601
|
+
|
|
602
|
+
### Luau:
|
|
603
|
+
|
|
604
|
+
```lua
|
|
605
|
+
local obliterator = Janitor.new()
|
|
606
|
+
obliterator:Add(function()
|
|
607
|
+
print("Removed One")
|
|
608
|
+
end, true, "One")
|
|
609
|
+
|
|
610
|
+
obliterator:Add(function()
|
|
611
|
+
print("Removed Two")
|
|
612
|
+
end, true, "Two")
|
|
613
|
+
|
|
614
|
+
obliterator:Add(function()
|
|
615
|
+
print("Removed Three")
|
|
616
|
+
end, true, "Three")
|
|
617
|
+
|
|
618
|
+
obliterator:RemoveList("One", "Two", "Three") -- Prints "Removed One", "Removed Two", and "Removed Three"
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
### TypeScript:
|
|
622
|
+
|
|
623
|
+
```ts
|
|
624
|
+
import { Janitor } from "@rbxts/janitor";
|
|
625
|
+
|
|
626
|
+
type NoOp = () => void
|
|
627
|
+
|
|
628
|
+
const obliterator = new Janitor<{ One: NoOp, Two: NoOp, Three: NoOp }>();
|
|
629
|
+
obliterator.Add(() => print("Removed One"), true, "One");
|
|
630
|
+
obliterator.Add(() => print("Removed Two"), true, "Two");
|
|
631
|
+
obliterator.Add(() => print("Removed Three"), true, "Three");
|
|
632
|
+
|
|
633
|
+
obliterator.RemoveList("One", "Two", "Three"); // Prints "Removed One", "Removed Two", and "Removed Three"
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
@since v1.14.0
|
|
637
|
+
@param ... unknown -- The indices you want to remove.
|
|
638
|
+
@return Janitor
|
|
639
|
+
]=]
|
|
640
|
+
function Janitor:RemoveList(...: any): Janitor
|
|
641
|
+
local this = Janitors[self]
|
|
642
|
+
if this then
|
|
643
|
+
local length = select("#", ...)
|
|
644
|
+
if length == 1 then
|
|
645
|
+
return Remove(self, ...)
|
|
646
|
+
end
|
|
647
|
+
if length == 2 then
|
|
648
|
+
local indexA, indexB = ...
|
|
649
|
+
Remove(self, indexA)
|
|
650
|
+
Remove(self, indexB)
|
|
651
|
+
return self
|
|
652
|
+
end
|
|
653
|
+
if length == 3 then
|
|
654
|
+
local indexA, indexB, indexC = ...
|
|
655
|
+
Remove(self, indexA)
|
|
656
|
+
Remove(self, indexB)
|
|
657
|
+
Remove(self, indexC)
|
|
658
|
+
return self
|
|
659
|
+
end
|
|
660
|
+
|
|
661
|
+
for selectIndex = 1, length do
|
|
662
|
+
local removeObject = select(selectIndex, ...)
|
|
663
|
+
Remove(self, removeObject)
|
|
664
|
+
end
|
|
665
|
+
end
|
|
666
|
+
|
|
667
|
+
return self
|
|
668
|
+
end
|
|
669
|
+
|
|
670
|
+
--[=[
|
|
671
|
+
Cleans up multiple objects at once without running their cleanup.
|
|
672
|
+
|
|
673
|
+
### Luau:
|
|
674
|
+
|
|
675
|
+
```lua
|
|
676
|
+
local obliterator = Janitor.new()
|
|
677
|
+
obliterator:Add(function()
|
|
678
|
+
print("Removed One")
|
|
679
|
+
end, true, "One")
|
|
680
|
+
|
|
681
|
+
obliterator:Add(function()
|
|
682
|
+
print("Removed Two")
|
|
683
|
+
end, true, "Two")
|
|
684
|
+
|
|
685
|
+
obliterator:Add(function()
|
|
686
|
+
print("Removed Three")
|
|
687
|
+
end, true, "Three")
|
|
688
|
+
|
|
689
|
+
obliterator:RemoveListNoClean("One", "Two", "Three") -- Nothing is printed.
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
### TypeScript:
|
|
693
|
+
|
|
694
|
+
```ts
|
|
695
|
+
import { Janitor } from "@rbxts/janitor";
|
|
696
|
+
|
|
697
|
+
type NoOperation = () => void
|
|
698
|
+
|
|
699
|
+
const obliterator = new Janitor<{ One: NoOperation, Two: NoOperation, Three: NoOperation }>();
|
|
700
|
+
obliterator.Add(() => print("Removed One"), true, "One");
|
|
701
|
+
obliterator.Add(() => print("Removed Two"), true, "Two");
|
|
702
|
+
obliterator.Add(() => print("Removed Three"), true, "Three");
|
|
703
|
+
|
|
704
|
+
obliterator.RemoveListNoClean("One", "Two", "Three"); // Nothing is printed.
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
@since v1.15.0
|
|
708
|
+
@param ... unknown -- The indices you want to remove.
|
|
709
|
+
@return Janitor
|
|
710
|
+
]=]
|
|
711
|
+
function Janitor:RemoveListNoClean(...: any): Janitor
|
|
712
|
+
local this = Janitors[self]
|
|
713
|
+
if this then
|
|
714
|
+
local length = select("#", ...)
|
|
715
|
+
if length == 1 then
|
|
716
|
+
local indexA = ...
|
|
717
|
+
local object = this[indexA]
|
|
718
|
+
if object then
|
|
719
|
+
self[object] = nil
|
|
720
|
+
this[indexA] = nil
|
|
721
|
+
end
|
|
722
|
+
return self
|
|
723
|
+
end
|
|
724
|
+
if length == 2 then
|
|
725
|
+
local indexA, indexB = ...
|
|
726
|
+
local objectA = this[indexA]
|
|
727
|
+
if objectA then
|
|
728
|
+
self[objectA] = nil
|
|
729
|
+
this[indexA] = nil
|
|
730
|
+
end
|
|
731
|
+
local objectB = this[indexB]
|
|
732
|
+
if objectB then
|
|
733
|
+
self[objectB] = nil
|
|
734
|
+
this[indexB] = nil
|
|
735
|
+
end
|
|
736
|
+
return self
|
|
737
|
+
end
|
|
738
|
+
if length == 3 then
|
|
739
|
+
local indexA, indexB, indexC = ...
|
|
740
|
+
local objectA = this[indexA]
|
|
741
|
+
if objectA then
|
|
742
|
+
self[objectA] = nil
|
|
743
|
+
this[indexA] = nil
|
|
744
|
+
end
|
|
745
|
+
local objectB = this[indexB]
|
|
746
|
+
if objectB then
|
|
747
|
+
self[objectB] = nil
|
|
748
|
+
this[indexB] = nil
|
|
749
|
+
end
|
|
750
|
+
local objectC = this[indexC]
|
|
751
|
+
if objectC then
|
|
752
|
+
self[objectC] = nil
|
|
753
|
+
this[indexC] = nil
|
|
754
|
+
end
|
|
755
|
+
return self
|
|
756
|
+
end
|
|
757
|
+
|
|
758
|
+
for selectIndex = 1, length do
|
|
759
|
+
local index = select(selectIndex, ...)
|
|
760
|
+
local object = this[index]
|
|
761
|
+
if object then
|
|
762
|
+
self[object] = nil
|
|
763
|
+
this[index] = nil
|
|
764
|
+
end
|
|
765
|
+
end
|
|
766
|
+
end
|
|
767
|
+
|
|
768
|
+
return self
|
|
769
|
+
end
|
|
770
|
+
|
|
771
|
+
--[=[
|
|
772
|
+
Returns a frozen copy of the Janitor's indices.
|
|
773
|
+
|
|
774
|
+
### Luau:
|
|
775
|
+
|
|
776
|
+
```lua
|
|
777
|
+
local obliterator = Janitor.new()
|
|
778
|
+
obliterator:Add(Workspace.Baseplate, "Destroy", "Baseplate")
|
|
779
|
+
print(obliterator:GetAll().Baseplate) -- Prints Baseplate.
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
### TypeScript:
|
|
783
|
+
|
|
784
|
+
```ts
|
|
785
|
+
import { Workspace } from "@rbxts/services";
|
|
786
|
+
import { Janitor } from "@rbxts/janitor";
|
|
787
|
+
|
|
788
|
+
const obliterator = new Janitor<{ Baseplate: Part }>();
|
|
789
|
+
obliterator.Add(Workspace.FindFirstChild("Baseplate") as Part, "Destroy", "Baseplate");
|
|
790
|
+
print(obliterator.GetAll().Baseplate); // Prints Baseplate.
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
@since v1.15.1
|
|
794
|
+
@return {[any]: any}
|
|
795
|
+
]=]
|
|
796
|
+
function Janitor:GetAll(): {[any]: any}
|
|
797
|
+
local this = Janitors[self]
|
|
798
|
+
return if this then table.freeze(table.clone(this)) else {}
|
|
799
|
+
end
|
|
800
|
+
|
|
801
|
+
--[=[
|
|
802
|
+
Calls each object's `methodName` (or calls the object if
|
|
803
|
+
`methodName == true`) and removes them from the Janitor. Also clears the
|
|
804
|
+
namespace. This function is also called when you call a Janitor object (so
|
|
805
|
+
it can be used as a destructor callback).
|
|
806
|
+
|
|
807
|
+
### Luau:
|
|
808
|
+
|
|
809
|
+
```lua
|
|
810
|
+
obliterator:Cleanup() -- Valid.
|
|
811
|
+
obliterator() -- Also valid.
|
|
812
|
+
```
|
|
813
|
+
|
|
814
|
+
### TypeScript:
|
|
815
|
+
|
|
816
|
+
```ts
|
|
817
|
+
obliterator.Cleanup()
|
|
818
|
+
// TypeScript version doesn't support the __call method of cleaning.
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
@method Cleanup
|
|
822
|
+
@within Janitor
|
|
823
|
+
]=]
|
|
824
|
+
local function Cleanup(self: Private): ()
|
|
825
|
+
if not self.CurrentlyCleaning then
|
|
826
|
+
local suppressInstanceReDestroy = self.SuppressInstanceReDestroy
|
|
827
|
+
local unsafeThreadCleanup = self.UnsafeThreadCleanup
|
|
828
|
+
|
|
829
|
+
self.CurrentlyCleaning = nil :: never
|
|
830
|
+
self.SuppressInstanceReDestroy = nil :: never
|
|
831
|
+
self.UnsafeThreadCleanup = nil :: never
|
|
832
|
+
|
|
833
|
+
local object, methodName = next(self)
|
|
834
|
+
while object and methodName do
|
|
835
|
+
if methodName == true then
|
|
836
|
+
if type(object) == "function" then
|
|
837
|
+
object()
|
|
838
|
+
else
|
|
839
|
+
local wasCancelled: boolean? = nil
|
|
840
|
+
if coroutine.running() ~= object then
|
|
841
|
+
wasCancelled = pcall(function()
|
|
842
|
+
task.cancel(object)
|
|
843
|
+
end)
|
|
844
|
+
end
|
|
845
|
+
|
|
846
|
+
if not wasCancelled then
|
|
847
|
+
local toCleanup = object
|
|
848
|
+
if unsafeThreadCleanup then
|
|
849
|
+
FastDefer(function()
|
|
850
|
+
task.cancel(toCleanup)
|
|
851
|
+
end)
|
|
852
|
+
else
|
|
853
|
+
task.defer(function()
|
|
854
|
+
task.cancel(toCleanup)
|
|
855
|
+
end)
|
|
856
|
+
end
|
|
857
|
+
end
|
|
858
|
+
end
|
|
859
|
+
else
|
|
860
|
+
if methodName == "Destroy" then
|
|
861
|
+
if self.SuppressInstanceReDestroy and typeof(object) == "Instance" then
|
|
862
|
+
pcall(Destroy, object)
|
|
863
|
+
else
|
|
864
|
+
local destroy = object.Destroy
|
|
865
|
+
if destroy then
|
|
866
|
+
destroy(object)
|
|
867
|
+
end
|
|
868
|
+
end
|
|
869
|
+
elseif methodName == "Disconnect" then
|
|
870
|
+
local disconnect = object.Disconnect
|
|
871
|
+
if disconnect then
|
|
872
|
+
disconnect(object)
|
|
873
|
+
end
|
|
874
|
+
else
|
|
875
|
+
local objectMethod = (object :: never)[methodName] :: (object: unknown) -> ()
|
|
876
|
+
if objectMethod then
|
|
877
|
+
objectMethod(object)
|
|
878
|
+
end
|
|
879
|
+
end
|
|
880
|
+
end
|
|
881
|
+
|
|
882
|
+
self[object] = nil
|
|
883
|
+
object, methodName = next(self, object)
|
|
884
|
+
end
|
|
885
|
+
|
|
886
|
+
local this = Janitors[self]
|
|
887
|
+
if this then
|
|
888
|
+
table.clear(this)
|
|
889
|
+
Janitors[self] = nil
|
|
890
|
+
end
|
|
891
|
+
|
|
892
|
+
self.CurrentlyCleaning = false
|
|
893
|
+
self.SuppressInstanceReDestroy = suppressInstanceReDestroy
|
|
894
|
+
self.UnsafeThreadCleanup = unsafeThreadCleanup
|
|
895
|
+
end
|
|
896
|
+
end
|
|
897
|
+
Private.Cleanup = Cleanup
|
|
898
|
+
|
|
899
|
+
--[=[
|
|
900
|
+
Calls [Janitor.Cleanup](#Cleanup) and renders the Janitor unusable.
|
|
901
|
+
|
|
902
|
+
:::warning Metatable Removal
|
|
903
|
+
Running this will make any further attempts to call a method of Janitor
|
|
904
|
+
error.
|
|
905
|
+
:::
|
|
906
|
+
]=]
|
|
907
|
+
function Janitor:Destroy(): ()
|
|
908
|
+
Cleanup(self)
|
|
909
|
+
table.clear(self :: never)
|
|
910
|
+
setmetatable(self :: any, nil)
|
|
911
|
+
end
|
|
912
|
+
|
|
913
|
+
Private.__call = Cleanup
|
|
914
|
+
|
|
915
|
+
local function LinkToInstance(self: Private, object: Instance, allowMultiple: boolean?): RBXScriptConnection
|
|
916
|
+
local indexToUse = if allowMultiple then newproxy(false) else LinkToInstanceIndex
|
|
917
|
+
|
|
918
|
+
return Add(self, object.Destroying:Connect(function()
|
|
919
|
+
Cleanup(self)
|
|
920
|
+
end), "Disconnect", indexToUse)
|
|
921
|
+
end
|
|
922
|
+
|
|
923
|
+
--[=[
|
|
924
|
+
"Links" this Janitor to an Instance, such that the Janitor will `Cleanup`
|
|
925
|
+
when the Instance is `Destroy()`d and garbage collected. A Janitor may only
|
|
926
|
+
be linked to one instance at a time, unless `allowMultiple` is true. When
|
|
927
|
+
called with a truthy `allowMultiple` parameter, the Janitor will "link" the
|
|
928
|
+
Instance without overwriting any previous links, and will also not be
|
|
929
|
+
overwritable. When called with a falsy `allowMultiple` parameter, the
|
|
930
|
+
Janitor will overwrite the previous link which was also called with a falsy
|
|
931
|
+
`allowMultiple` parameter, if applicable.
|
|
932
|
+
|
|
933
|
+
### Luau:
|
|
934
|
+
|
|
935
|
+
```lua
|
|
936
|
+
local obliterator = Janitor.new()
|
|
937
|
+
|
|
938
|
+
obliterator:Add(function()
|
|
939
|
+
print("Cleaning up!")
|
|
940
|
+
end, true)
|
|
941
|
+
|
|
942
|
+
do
|
|
943
|
+
local folder = Instance.new("Folder")
|
|
944
|
+
obliterator:LinkToInstance(folder)
|
|
945
|
+
folder:Destroy()
|
|
946
|
+
end
|
|
947
|
+
```
|
|
948
|
+
|
|
949
|
+
### TypeScript:
|
|
950
|
+
|
|
951
|
+
```ts
|
|
952
|
+
import { Janitor } from "@rbxts/janitor";
|
|
953
|
+
|
|
954
|
+
const obliterator = new Janitor();
|
|
955
|
+
obliterator.Add(() => print("Cleaning up!"), true);
|
|
956
|
+
|
|
957
|
+
{
|
|
958
|
+
const folder = new Instance("Folder");
|
|
959
|
+
obliterator.LinkToInstance(folder, false);
|
|
960
|
+
folder.Destroy();
|
|
961
|
+
}
|
|
962
|
+
```
|
|
963
|
+
|
|
964
|
+
@method LinkToInstance
|
|
965
|
+
@within Janitor
|
|
966
|
+
|
|
967
|
+
@param object Instance -- The instance you want to link the Janitor to.
|
|
968
|
+
@param allowMultiple? boolean -- Whether or not to allow multiple links on the same Janitor.
|
|
969
|
+
@return RBXScriptConnection -- A RBXScriptConnection that can be disconnected to prevent the cleanup of LinkToInstance.
|
|
970
|
+
]=]
|
|
971
|
+
Private.LinkToInstance = LinkToInstance;
|
|
972
|
+
|
|
973
|
+
(Janitor :: never).LegacyLinkToInstance = LinkToInstance
|
|
974
|
+
|
|
975
|
+
--[=[
|
|
976
|
+
Links several instances to a new Janitor, which is then returned.
|
|
977
|
+
|
|
978
|
+
@param ... Instance -- All the Instances you want linked.
|
|
979
|
+
@return Janitor -- A new Janitor that can be used to manually disconnect all LinkToInstances.
|
|
980
|
+
]=]
|
|
981
|
+
function Janitor:LinkToInstances(...: Instance): Janitor
|
|
982
|
+
local manualCleanup = Janitor.new()
|
|
983
|
+
for index = 1, select("#", ...) do
|
|
984
|
+
local object = select(index, ...)
|
|
985
|
+
if typeof(object) ~= "Instance" then
|
|
986
|
+
continue
|
|
987
|
+
end
|
|
988
|
+
|
|
989
|
+
manualCleanup:Add(LinkToInstance(self, object, true), "Disconnect")
|
|
990
|
+
end
|
|
991
|
+
|
|
992
|
+
return manualCleanup
|
|
993
|
+
end
|
|
994
|
+
|
|
995
|
+
function Private:__tostring()
|
|
996
|
+
return "Janitor"
|
|
997
|
+
end
|
|
998
|
+
|
|
999
|
+
return Janitor :: Static
|