Problems with GetBindingByKey

From Wowpedia: GetBindingByKey
Returns the binding action performed when the specified key combination is triggered.

bindingAction = GetBindingByKey(key)

Arguments

key
string - binding key to query, e.g. “G”, “ALT-G”, “ALT-CTRL-SHIFT-F1”.

I have “Blade of Justice” on 1.

bindingAction = GetBindingByKey(“1”)
print(bindingAction) prints nil

Same for “ACTIONBUTTON1”

I have left J mapped to guild panel. Copying the code from the example I have:
Code:

key = “J”
bindingAction = GetBindingByKey(key)
print(bindingAction)

Again it prints ‘nil’

Can anyone see what I am doing wrong?

You have directional quotes there. I don’t know if they were like that in your code, but it’s possible if those aren’t working you copy-pasted it from elsewhere and your code has the directional quotes. (The forum seems to automatically convert to directional quotes, so it’s possible they were fine in your code; but I can’t think of a reason that would cause those simple statements to fail.)

These should work:

local bindingAction = GetBindingByKey("1")
print(bindingAction)
local key = "J"
local bindingAction = GetBindingByKey(key)
print(bindingAction)