Skip to main content
Version: 9.0.2

gre.key_down

gre.key_down(
code,
[channel]
)

Send a gre.keydown event to the application with the scancode passed in the parameters.

Parameters

ParameterTypeDescription
code#stringThe UTF-8 character code to inject channel An optional Storyboard IO channel to send the event on, if not specified the event is added directly into the current Storyboard application event queue if neither the environment variable or global GREIONAME variable are set.
channel#string[Optional] The Storyboard IO channel on which to send the event. If not specified the event is added directly into the current Storyboard application event queue if neither the environment variable or global GREIONAME variable are set.

Returns

TypeDescription
#booleantrue for success, false for failure
#stringnil for success and an error message, e.g. "Can't open greio channel my_channel" on failure

Example

function CBSpaceDown()
gre.key_down(0x20)
end

function CBSendSpaceDown()
local success, error = gre.key_down(0x20, "my_channel")
if(success == false) then
print(error)
--handle error
end
end