[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: file proxy?
- From: spir <denis.spir@...>
- Date: Fri, 12 Feb 2010 13:13:05 +0100
Hello,
I'm looking for a way to "subtype" Lua files, for file objects to hold additional attributes. It seems I cannot directly set attributes on Lua Files, since they are userdata. Is there a way to write a custom file type that delegates file methods to an actual Lua file (open in mode 'r')? My trials using __index with a table or function launch errors like:
lua: _essai.lua:44: calling 'read' on bad self (FILE* expected, got table)
stack traceback:
[C]: in function 'read'
_essai.lua:44: in main chunk
[C]: ?
How should I write __index to call a method on a *FILE?
Denis
________________________________
la vita e estrany
http://spir.wikidot.com/