Lua初始化时如何实现表的自引用?
- 内容介绍
- 文章标签
- 相关推荐
本文共计207个文字,预计阅读时间需要1分钟。
有更简洁的方法来完成这一点:`local thisismytable={non=sequitur}; thisismytable.whatismytable=thisismytable;` 任何帮助,请告知。我不想重新创建已经存在的功能。没有。如果可以站在这两个表之间,请告诉我。
有没有更短的方法来做到这一点:local thisismytable = { non = sequitur } thisismytable.whatismytable = thisismytable
任何帮助,将不胜感激.
我不想重新创建预先存在的功能.
如果你能够站在这两个表达式之间的区别这个主题:whatismytable()而不是thisismytable.whatismytable,你可以这样做:
local thisismytable = { non = sequitur, whatismytable = function (self) return self end }
测试:
print(thisismytable) print(thisismytable:whatismytable())
更多用法:
print(thisismytable:whatismytable().non)
本文共计207个文字,预计阅读时间需要1分钟。
有更简洁的方法来完成这一点:`local thisismytable={non=sequitur}; thisismytable.whatismytable=thisismytable;` 任何帮助,请告知。我不想重新创建已经存在的功能。没有。如果可以站在这两个表之间,请告诉我。
有没有更短的方法来做到这一点:local thisismytable = { non = sequitur } thisismytable.whatismytable = thisismytable
任何帮助,将不胜感激.
我不想重新创建预先存在的功能.
如果你能够站在这两个表达式之间的区别这个主题:whatismytable()而不是thisismytable.whatismytable,你可以这样做:
local thisismytable = { non = sequitur, whatismytable = function (self) return self end }
测试:
print(thisismytable) print(thisismytable:whatismytable())
更多用法:
print(thisismytable:whatismytable().non)

