Lua 中的 @at 符号是什么意思?
What does the @ at sign mean in Lua?
我看了Get containing path of lua file,我可以看到:
print(debug.getinfo(1).source)
...结果例如:
@/Users/e/test.lua
显然,作为路径,这是一个字符串 - 但“at 符号”/“at 字符”@
的用途是什么;这是什么意思?
通过互联网搜索 Lua "at sign"
(即使带引号)
,很难找到与此相关的有用信息
表示函数定义在文件中
来自Lua 5.4 Reference Manual: 4.7 The Debug Interface
The fields of lua_Debug have the following meaning:
source: the source of the chunk that created the function. If source
starts with a '@', it means that the function was defined in a file
where the file name follows the '@'. If source starts with a '=', the
remainder of its contents describes the source in a user-dependent
manner. Otherwise, the function was defined in a string where source
is that string.
Lua 手册列出了 @ 的其他用法。例如 warn("@off")
可用于关闭警告的发出。
我看了Get containing path of lua file,我可以看到:
print(debug.getinfo(1).source)
...结果例如:
@/Users/e/test.lua
显然,作为路径,这是一个字符串 - 但“at 符号”/“at 字符”@
的用途是什么;这是什么意思?
通过互联网搜索 Lua "at sign"
(即使带引号)
表示函数定义在文件中
来自Lua 5.4 Reference Manual: 4.7 The Debug Interface
The fields of lua_Debug have the following meaning:
source: the source of the chunk that created the function. If source starts with a '@', it means that the function was defined in a file where the file name follows the '@'. If source starts with a '=', the remainder of its contents describes the source in a user-dependent manner. Otherwise, the function was defined in a string where source is that string.
Lua 手册列出了 @ 的其他用法。例如 warn("@off")
可用于关闭警告的发出。