Hello!
Despite having read several resources including the official Lua documentation (PIL, etc) about Metatables and OOP in Lua, I still have a difficult time understanding these concepts.
For example - I am looking at the following code on http://lua-users.org/wiki/LuaClassesWithMetatable:
[lua]Lua 5.0.3 Copyright © 1994-2006 Tecgraf, PUC-Rio
> t = { 11, 22, 33, you=‘one’, me=‘two’ }
> mt = { __index = print }
> = t.you
one
> = t.fred
nil
> setmetatable(t, mt)
> x = t.fred
table: 0x8075e80 fred
> = x
nil
> = t
table: 0x8075e80
> [/lua]
Okay, I see that the metatable has provided the ability for the result to be table: 0x8075e80 fred instead of nil. Not to sound rude, by so what?
i.e. Is there some practical example you all can demonstrate using metatables/OOP, specifically in Corona?
I think I would have a better time understanding metatables and OOP via Corona-related examples, and this would help in understanding Lua in general.
Thank you for your help! [import]uid: 32833 topic_id: 7231 reply_id: 307231[/import]