I am working through oBindings by haste -- making sense of it... And I got to this little bit which even my googleFu can't understand
Basically I get lost on the
Lua Code:
for key, action in next, tbl do
I have NO idea what the function of the next there is. Normally it should be a keyword/function to go to the next part of the table, but in this I just don't get what it does.
-- Note the comments are mine and may not make sense.
Lua Code:
function _NS:RegisterKeyBindings(name, ...)
local bindings = {}
for i=1, select('#', ...) do -- for i=1, number of entries in the ellipsis (which are the possible tables passed via registerkeybindings)
local tbl = select(i, ...) -- pushes the possible tables into tbl
for key, action in next, tbl do -- puts [x] into key, the value into action of tbl
if(type(action) == 'table') then -- ??
for mod, modAction in next, action do -- (['CTRL-V'] = 'Paste' - CTRL = mod, 'paste' is modAction)
if(not bindings[key]) then -- if no key is listed, it's just a spell, so increment and bind it to the number keys
bindings[key] = {}
end
bindings[key][mod] = modAction
end
else
bindings[key] = action -- normal keybind
end
end
end
_BINDINGS[name] = bindings
end
For those of you willing to see the entire code instead of just a part :
https://github.com/haste/oBindings/b...r/bindings.lua