Page 1 of 1

How to bind a key to the certain Lua function in the widget?

Posted: 19 Jul 2015, 23:53
by jetbird
Is it possible?

Re: How to bind a key to the certain Lua function in the widget?

Posted: 20 Jul 2015, 06:08
by gajop
You could always write custom code that would handle key presses and invoke Lua functions.

Re: How to bind a key to the certain Lua function in the widget?

Posted: 20 Jul 2015, 08:19
by Silentwings
Read https://springrts.com/wiki/Lua:Callins and look at addon.KeyPress(key, mods, isRepeat). It's not a binding in the uikeys sense.

Re: How to bind a key to the certain Lua function in the widget?

Posted: 20 Jul 2015, 09:42
by FLOZi
btw you can link directly to each function https://springrts.com/wiki/Lua:Callins#API:KeyPress

Re: How to bind a key to the certain Lua function in the widget?

Posted: 20 Jul 2015, 12:52
by jetbird
Thanks!

Re: How to bind a key to the certain Lua function in the widget?

Posted: 30 Jul 2015, 22:55
by jamerlan
Also smth like this:

Code: Select all

131	    widgetHandler:AddAction("losradar", toggleLOSRadars)
132	    widgetHandler:AddAction("loscolor", toggleLOSColors)
133	
134	    spSendCommands('unbindkeyset Any+;')
135	    spSendCommands('bind Any+; losradar')
take a look here: http://imolarpg.dyndns.org/trac/balates ... colors.lua