Extensions
Available in: Client Only
This module runs entirely on the client side. It handles the UI, inputs and visual effects.
Same idea as Component Extensions, applied to ActionMaps: observe the Enable/Disable lifecycle without touching the ActionMap's own binding logic the tool for cross-cutting behavior like logging every control-scheme switch or driving a debug overlay that shows which ActionMap is currently active.
Available hooks
| Hook | Fires |
|---|---|
Enabling |
Before :Enable() binds anything to ContextActionService |
Enabled |
After :Enable() has finished binding |
Disabling |
Before :Disable() unbinds anything |
Disabled |
After :Disable() has finished unbinding |
Creating and attaching an extension
local Owl = require(ReplicatedStorage.OwlKnit.Owl)
local OwlAction = Owl.Util.Action
local LogExtension = OwlAction.CreateExtension({
Name = "Logger",
Hooks = {
Enabled = function(map)
print(("[ActionMap] %s enabled (priority %d)"):format(map.Name, map._priority))
end,
Disabled = function(map)
print(("[ActionMap] %s disabled"):format(map.Name))
end,
},
})
local CombatMap = OwlAction.CreateActionMap({
Name = "Combat",
Actions = { --[[ ... ]] },
Extensions = { LogExtension },
})Every hook receives the ActionMap itself (map), so the same extension attaches cleanly to any number of ActionMaps LogExtension above works identically whether it's attached to Combat, Menu or any other map.
An extension that throws inside a hook doesn't stop other extensions from running, or the ActionMap itself from enabling the error is caught per-extension and shown as a warning, the same isolation guarantee as Component Extensions.
Where to go next
- Overview - creating an ActionMap, binding callbacks and the Enable/Disable lifecycle these hooks wrap around.