mail-storage-lua.c (dovecot-2.3.16) | : | mail-storage-lua.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 65 | skipping to change at line 65 | |||
DLUA_TABLE_END | DLUA_TABLE_END | |||
}; | }; | |||
static luaL_Reg lua_storage_methods[] = { | static luaL_Reg lua_storage_methods[] = { | |||
{ NULL, NULL } | { NULL, NULL } | |||
}; | }; | |||
void dlua_register_mail_storage(struct dlua_script *script) | void dlua_register_mail_storage(struct dlua_script *script) | |||
{ | { | |||
/* get dlua_dovecot */ | /* get dlua_dovecot */ | |||
dlua_getdovecot(script->L); | dlua_get_dovecot(script->L); | |||
/* Create table for holding values */ | /* Create table for holding values */ | |||
lua_newtable(script->L); | lua_newtable(script->L); | |||
dlua_setmembers(script->L, lua_storage_mail_storage_flags, -1); | dlua_set_members(script->L, lua_storage_mail_storage_flags, -1); | |||
/* push new metatable to stack */ | /* push new metatable to stack */ | |||
luaL_newmetatable(script->L, LUA_SCRIPT_STORAGE); | luaL_newmetatable(script->L, LUA_SCRIPT_STORAGE); | |||
/* this will register functions to the metatable itself */ | /* this will register functions to the metatable itself */ | |||
luaL_setfuncs(script->L, lua_storage_methods, 0); | luaL_setfuncs(script->L, lua_storage_methods, 0); | |||
/* point __index to self */ | /* point __index to self */ | |||
lua_pushvalue(script->L, -1); | lua_pushvalue(script->L, -1); | |||
lua_setfield(script->L, -1, "__index"); | lua_setfield(script->L, -1, "__index"); | |||
/* set table's metatable, pops stack */ | /* set table's metatable, pops stack */ | |||
lua_setmetatable(script->L, -2); | lua_setmetatable(script->L, -2); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |