| 86 | |
| 87 | |
| 88 | int ap_lua_init(lua_State *L, apr_pool_t *p) |
| 89 | { |
| 90 | luaL_newmetatable(L, "Apr.Table"); |
| 91 | #if LUA_VERSION_NUM < 502 |
| 92 | luaL_register(L, "apr_table", lua_table_methods); |
| 93 | #else |
| 94 | luaL_newlib(L, lua_table_methods); |
| 95 | #endif |
| 96 | lua_pushstring(L, "__index"); |
| 97 | lua_pushstring(L, "get"); |
| 98 | lua_gettable(L, 2); |
| 99 | lua_settable(L, 1); |
| 100 | |
| 101 | lua_pushstring(L, "__newindex"); |
| 102 | lua_pushstring(L, "set"); |
| 103 | lua_gettable(L, 2); |
| 104 | lua_settable(L, 1); |
| 105 | |
| 106 | return 0; |
| 107 | } |
| 108 | |
| 109 | |
| 110 |