/* ensure that stack has a table and push that table into the stack  */
LUALIB_API int luaL_getsubtable(lua_State *L, int idx, const char *fname)
/* ensure that stack has a table and push that table into the stack  */
LUALIB_API int luaL_getsubtable(lua_State *L, int idx, const char *fname)
{
    lua_pop(L, 1);
    idx = lua_absindex(L, idx);
    lua_newtable(L);
    lua_pushvalue(L, -1);
    lua_setfield(L, idx, fname);
    return 0;
  }
}