lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello listers,
I have tried some inheritance with Penlight class support. However, I don't know how to call the parent constructor. This code fails, so I ask: what is wrong:

class = require('pl.class')

class.control()

function control:_init(title)
self.title = title
end

class.window(control)

function window:_init(title)
control:_init(title)
end

function window:show()
print(self.title)
end

window = window('Hello World')
window:show()