lua-users home
lua-l archive

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

> You'll find about this at the archives:
> +nil&sort=score&idxname=lua-l&max=20

The most relevant (and recent) thread about this starts at

In particular, see these answers:

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_createtable(L, 0, 1);
  lua_setfield(L, -2, "__index");
  lua_setmetatable(L, -2);
  return 0;