programming in lua, objects
Posted
by anon
on Stack Overflow
See other posts from Stack Overflow
or by anon
Published on 2010-05-03T22:47:19Z
Indexed on
2010/05/03
22:58 UTC
Read the original article
Hit count: 179
lua
Sample code:
function Account:new (o)
o = o or {} -- create object if user does not provide one
setmetatable(o, self)
self.__index = self
return o
end
taken from:
http://www.lua.org/pil/16.1.html
What is the purpose of the:
self.__index = self
line? And why is it executed every time an object is created?
© Stack Overflow or respective owner