无法调用 Lua 中的函数

Can't call a function in Lua

好的,所以我确定这个错误真的很愚蠢,但出于某种原因我无法理解,所以非常感谢您的帮助:)

 local function Selector()
  x = math.random(1,2)
  if x == 1 then
    Veshtica

  end
end

"Veshtica" 是我要调用的函数。 错误消息 - “”= 预期接近尾声

calling a function in Lua没有参数时需要加上括号。

If the function call has no arguments, we must write an empty list () to indicate the call.

因此你需要做 Veshtica() 而不能只做 Veshtica.

如果函数调用有参数那么你可以做 print("Hello World!") 但也可以简单地 print "Hello World!".

注意:

There is a special case to this rule: If the function has one single argument and this argument is either a literal string or a table constructor, then the parentheses are optional.

换句话说,你可以print "Hello World!"但你不能math.cos 10