How to bind a key to the certain Lua function in the widget?
Moderator: Moderators
How to bind a key to the certain Lua function in the widget?
Is it possible?
Re: How to bind a key to the certain Lua function in the widget?
You could always write custom code that would handle key presses and invoke Lua functions.
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: How to bind a key to the certain Lua function in the widget?
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?
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?
Also smth like this:
take a look here: http://imolarpg.dyndns.org/trac/balates ... colors.lua
Code: Select all
131 widgetHandler:AddAction("losradar", toggleLOSRadars)
132 widgetHandler:AddAction("loscolor", toggleLOSColors)
133
134 spSendCommands('unbindkeyset Any+;')
135 spSendCommands('bind Any+; losradar')