mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-29 16:24:35 +00:00
updated class docs about super construction
This commit is contained in:
parent
7813bf35a1
commit
453f00d82f
10
class.lua
10
class.lua
@ -1,8 +1,18 @@
|
|||||||
--[[
|
--[[
|
||||||
barebones oop basics
|
barebones oop basics
|
||||||
|
|
||||||
|
construction
|
||||||
|
|
||||||
call the class object to construct a new instance
|
call the class object to construct a new instance
|
||||||
|
|
||||||
|
this will construct a new table, assign it as a class
|
||||||
|
instance, and call `new`
|
||||||
|
|
||||||
|
if you are defining a subclass, you will need to call
|
||||||
|
`self:super(...)` as part of `new` to complete superclass
|
||||||
|
construction - if done correctly this will propagate
|
||||||
|
up the chain and you wont have to think about it
|
||||||
|
|
||||||
classes are used as metatables directly so that
|
classes are used as metatables directly so that
|
||||||
metamethods "just work" - except for index, which is
|
metamethods "just work" - except for index, which is
|
||||||
used to hook up instance methods
|
used to hook up instance methods
|
||||||
|
Loading…
Reference in New Issue
Block a user