Lua 脚本错误,G-Key 脚本 SetMkeyState

我有一只 G602 鼠标,想要使用 DPI 敏感的按钮(G10、G11)来控制我的 G910 键盘的 M-Key 状态。我正在试着为此编写一个 Lua 脚本,但在尝试设置基于 API 文档示例的 M-Key 状态时遇到了问题:

if event == "MOUSE_BUTTON_PRESSED" and arg == 11 then
    SetMkeyState(1,"kb")
end

我收到以下错误提示:

[string "LuaVM"]:20: attempt to call global 'SetMkeyState' (a nil value)

我甚至尝试了 API 文档中的精确示例,也收到了同样的错误提示:

-- Set the current M Key state to M1 when G1 is pressed
function OnEvent(event, arg)
    if (event == "G_PRESSED" and arg == 1) then
        SetMkeyState(1);
    end
end
点赞
用户1068128
用户1068128

这个命令是区分大小写的,API文档中的示例存在一个拼写错误。SetMkeyState中的K应该是大写的。

使用SetMKeyState可以正常工作:

if event == "MOUSE_BUTTON_PRESSED" and arg == 11 then
    SetMKeyState(1,"kb")
end
2017-07-17 20:41:08