[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: (no subject)
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 24 Apr 2007 14:11:15 -0300
> You'll find about this at the archives:
> http://lua-users.org/cgi-bin/namazu.cgi?query=attempt+to+index+a
> +nil&sort=score&idxname=lua-l&max=20
The most relevant (and recent) thread about this starts at
http://lua-users.org/lists/lua-l/2006-11/msg00636.html
In particular, see these answers:
http://lua-users.org/lists/lua-l/2006-11/msg00639.html
http://lua-users.org/lists/lua-l/2006-11/msg00645.html
If you need C code for this, here it is:
#include "lua.h"
static int indexnil (lua_State *L) {
return 0;
}
LUALIB_API int luaopen_nil (lua_State *L) {
lua_pushnil(L);
lua_createtable(L, 0, 1);
lua_pushcfunction(L,indexnil);
lua_setfield(L, -2, "__index");
lua_setmetatable(L, -2);
return 0;
}
--lhf