|
On Oct 14, 2004, at 01:16, Tom Spilman wrote:
-----Original Message----- From: lua-bounces@bazar2.conectiva.com.br [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of David Given Sent: Wednesday, October 13, 2004 4:44 PM To: Lua list Subject: Re: Userdata with methods *and* table access.* You musn't read past the end of the string, because you may overrun the memory block and cause a segmentation fault. That's why you need the if statement in the first example.True, but could Lua ever pass an empty key to the __index metamethod?
You mean a key that is a string that is empty? Sure: a[""] = 7 Anything apart from nil can be used as a table key. a[function()end]=7 David Jones