我是 的初学者Lua,我对().
这里有一些关于 的例子Lua5.3。
a = '%s %s'
a:format("Hello", "World") -- Hello World
'%s %s':format("Hello", "World") -- stdin:1: unexpected symbol near ''%s %s''
('%s %s'):format("Hello", "World") -- Hello World
type(a) == type('%s %s') -- true
getmetatable(a) -- table: 0x1f20bf0
getmetatable('%s %s') -- table: 0x1f20bf0 for any other hard coded strings
Run Code Online (Sandbox Code Playgroud)
题:
()对硬编码字符串做了什么?lua ×1