Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Function “.”附近出现意外符号_Function_Variables_Lua - Fatal编程技术网

Function “.”附近出现意外符号

Function “.”附近出现意外符号,function,variables,lua,Function,Variables,Lua,我试着换成ansi,但没用。 它位于第5行:“.”附近的意外符号中 side = { 0, Arena.width } function Update() local chasingbullet = CreateProjectile('bullet', myTable[ math.random( #myTable )], math.random(0, Arena.height)) local chasingbullet.SetVar('speed', 0) local

我试着换成ansi,但没用。 它位于第5行:“.”附近的意外符号中

side =  { 0, Arena.width }

function Update()
    local chasingbullet = CreateProjectile('bullet', myTable[ math.random( #myTable )], math.random(0, Arena.height))
    local chasingbullet.SetVar('speed', 0)
    local dist = Player.x - chasingbullet.x
    local speed = chasingbullet.GetVar('xspeed') / 2 + xdifference / 100
    chasingbullet.Move(speed, 0)
    chasingbullet.SetVar('speed', speed)
end
我搜索的每个地方,不要帮我说代码是正常的。

本地chasingbill.SetVar'speed',0有语法错误。local只能后跟变量名或名称列表以及可选的等号和表达式列表;例如:

local a
local a = 1
local a, b
local a, b = 1, 2
local a, b = 1

所以解析器可以使用局部chasingbill,但是它看到了点。因为那里不允许有点而抱怨。要修复此错误,只需删除local:chasingbill.SetVar'speed',0。

这是一个语法/解析错误:那么,哪一行以及该行的哪一部分?在确定错误消息所指的内容之后,为什么该错误有意义?提示:关于局部变量和什么变量是什么变量不是什么。