lua-users home
lua-l archive

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

On Thu, Apr 19, 2007 at 11:53:15AM -0700, Mark Hamburg wrote:
> Except that you can't get to userdata metatables from pure Lua. But one
> could certainly replace pairs with a C function that did this and you don't
> need to patch the Lua sources to do it.

Maybe I misunderstand "get to", but  it appears that I can access
userdata from the io library. Is this a version thing?

% lua5.1
Lua 5.1.1  Copyright (C) 1994-2006, PUC-Rio
> = getmetatable(io.stdin)
table: 0x806cae0
> = io.stdin
file (0xb7e8f420)
> return  type(io.stdin)
> for k,v in pairs(getmetatable(io.stdin)) do print(k,v) end
setvbuf function: 0x806cc28
lines   function: 0x806cc68
write   function: 0x806cdc0
close   function: 0x806cba0
flush   function: 0x806cbd8
__gc    function: 0x806cdf8
read    function: 0x806cca0
seek    function: 0x806cbf0
__index table: 0x806cae0
__tostring      function: 0x806ccd8