Lua 中双冒号的作用是什么?

What is the purpose of double colons in Lua?

我知道 Lua 的 5.3 版本不久前已经发布,但直到现在才有理由访问在线文档。我可能是错的,但我不相信要记住双冒号的用法 :: 就像它在那里被大量使用一样。

我看到它被认为是 "special token",就像其他人一样(大于、小于、星号等),但我知道它们的用途。

在Lua中使用它们的目的是什么?

:: 仅用于 Lua *:

中的一件事

Declaring labels for jumping with goto.

goto label
::label::

The goto statement transfers the program control to a label. For syntactical reasons, labels in Lua are considered statements too:

stat ::= goto Name
stat ::= label
label ::= ‘::’ Name ‘::’

A label is visible in the entire block where it is defined, except inside nested blocks where a label with the same name is defined and inside nested functions. A goto may jump to any visible label as long as it does not enter into the scope of a local variable.

Labels and empty statements are called void statements, as they perform no actions.

* 我不认为在 Lua 本身的文档中广泛使用扩展 BNF。