C#具有this
,而VB具有ME
。 Lua等价的是什么?
我正在尝试引用Roblox中脚本类的父级。
最佳答案
在Lua documentation section 2.5.9中,自我引用通常是self
:
The colon syntax is used for defining methods, that is, functions that have an implicit extra parameter
self
. Thus, the statementfunction t.a.b.c:f (params) body end
is syntactic sugar for
t.a.b.c.f = function (self, params) body end
关于oop - 对象如何在Lua中引用自身?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1066886/