试图呼叫字段' ADD' (零值)

时间:2014-07-10 20:43:55

标签: lua garrys-mod

当我将命令绑定到键时,它一直告诉我" Unknown command: TestJump"。这是我的工作,我在控制台中运行命令" lua_openscript_cl TestJump"然后我做"绑定e" TestJump,"但这就是它开始告诉我命令是未知的地方,它也告诉我"某些东西正在创建脚本错误"当我运行命令打开脚本时,也是当它给我下面的错误时。

错误:

[ERROR] lua/testjump.lua:11: attempt to call field 'ADD' (a nil value)
1. unknown - lua/testjump.lua:11

代码:

function TestJump()
    timer.simple(.7,jump) -- Jumps --
    timer.simple(.7, function() RunConsoleCommand("+jump") end)
    timer.simple(.72, function() RunConsoleCommand("-Jump") end)
end
-- Jumps --
function jump() -- Not sure if I'm even supposed to do this --
    LocalPlayer():SetEyeAngles(LocalPlayer():EyeAngles()-Angle(0,10,0))
end
-- ^ not sure what I am supposed to do with the EyeAngle --
concommand.ADD("Test",TestJump) -- Where I think the error is --

1 个答案:

答案 0 :(得分:0)

seems正确的名称是Add,而不是ADD。 Lua区分大小写。