Menu
Lumberyard
User Guide (Version 1.13)

Input Request Bus

Use the following functions with the input request bus interface to communicate with other components of your game.

For more information about using the event bus (EBus) interface, see Working with the Event Bus (EBus) System.

InputRequestBus

PushContext

Pushes a new context onto the stack, which then becomes the active context.

PopContext

Removes the top context from the input context stack.

PopAllContexts

Clears the context stack, and the active context becomes "".

GetCurrentContext

Returns the context at the top of the stack. If the stack is empty, returns "".

The following is an example script.

local foo { Properties = { Context {default = "", description = "A context to push onto the input stack. Like console, or UI, or turret, under water, etc."}, } } function foo:OnActivate() -- by default the context is blank "" InputRequestBus.Broadcast.PushContext(self.Properties.Context) -- context stack is now 1)user defined property InputRequestBus.Broadcast.PushContext("under water") -- context stack is now 1)user defined property, 2) "under water" Debug.Log(InputRequestBus.Broadcast.GetCurrentContext()) -- prints "under water" InputRequestBus.Broadcast.PushContext("for fun") -- context stack is now 1)use defined property, 2) "under water", 3) "for fun" InputRequestBus.Broadcast.PopContext() -- context stack is now 1)user defined property, 2) "under water" InputRequestBus.Broadcast.PopAllContexts() context stack is now empty end return foo

On this page: