input.createcontext

Creates a script input context.

Syntax

Signature
input.createcontext() -> InputContext

Aliases

This function has no aliases.

Parameters

This function takes no parameters.

Returns

TypeDescription
InputContextContext with setcapture, setregion, getpointer, getevents, and destroy methods.

Notes

Keep the returned userdata while using it and call destroy when finished. Each platform allows up to 32 live contexts.

Example

Luau
local Context = input.createcontext()
Context:setregion(20, 20, 200, 100)
Context:setcapture(false, true)
for _, Event in Context:getevents() do print(Event.Type) end
Context:destroy()