[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: mettables and the io library
- From: "D Burgess" <db@...>
- Date: Mon, 18 Aug 2003 13:25:58 +1000
I am trying to get my head around the Lua 5 io library and
I have questions;
In the code below how is it that the __index table recurses to
itself? Why is this done?
and, how does _input and _output make it into the metatable?
> h=io.open("x","w")
> x=getmetatable(h)
> =x
table: 00302770
> table.foreach(x,print)
lines function: 00302320
write function: 00302370
close function: 003021B0
flush function: 003023F0
__gc function: 00302190
read function: 00302430
_output file (00303C50)
_input file (00303CB0)
seek function: 003023B0
__index table: 00302770
__tostring function: 003022D0
> table.foreach(x.__index,print)
lines function: 00302320
write function: 00302370
close function: 003021B0
flush function: 003023F0
__gc function: 00302190
read function: 00302430
_output file (00303C50)
_input file (00303CB0)
seek function: 003023B0
__index table: 00302770
__tostring function: 003022D0