你知道当你在 python 中创建一个类时你是怎么做的,
class className(object):
def __init__(self):
# INIT called first in a class
我的问题是你将如何在 lua 中做到这一点?lua中甚至有课程吗?如果是这样的话,Lua 中的 python 函数就像 __init__()
我刚刚开始学习 Lua 5.1 并且我注意到我还没有上过课。例如,用于在 Lua 中创建类的 Luas 表系统。
function getName(name) return name end
local className -- class
className['getName'] = getName
className.getName('name')