dlua-script.c (dovecot-2.3.16) | : | dlua-script.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 384 | skipping to change at line 384 | |||
i_assert(script->ref > 0); | i_assert(script->ref > 0); | |||
if (--script->ref > 0) | if (--script->ref > 0) | |||
return; | return; | |||
dlua_script_destroy(script); | dlua_script_destroy(script); | |||
} | } | |||
bool dlua_script_has_function(struct dlua_script *script, const char *fn) | bool dlua_script_has_function(struct dlua_script *script, const char *fn) | |||
{ | { | |||
i_assert(script != NULL); | i_assert(script != NULL); | |||
lua_getglobal(script->L, fn); | lua_getglobal(script->L, "_G"); | |||
lua_pushstring(script->L, fn); | ||||
lua_rawget(script->L, -2); | ||||
bool ret = lua_isfunction(script->L, -1); | bool ret = lua_isfunction(script->L, -1); | |||
lua_pop(script->L, 1); | lua_pop(script->L, 2); | |||
return ret; | return ret; | |||
} | } | |||
void dlua_setmembers(lua_State *L, const struct dlua_table_values *values, | void dlua_set_members(lua_State *L, const struct dlua_table_values *values, | |||
int idx) | int idx) | |||
{ | { | |||
i_assert(L != NULL); | i_assert(L != NULL); | |||
i_assert(lua_istable(L, idx)); | i_assert(lua_istable(L, idx)); | |||
while(values->name != NULL) { | while(values->name != NULL) { | |||
switch(values->type) { | switch(values->type) { | |||
case DLUA_TABLE_VALUE_STRING: | case DLUA_TABLE_VALUE_STRING: | |||
lua_pushstring(L, values->v.s); | lua_pushstring(L, values->v.s); | |||
break; | break; | |||
case DLUA_TABLE_VALUE_INTEGER: | case DLUA_TABLE_VALUE_INTEGER: | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 5 lines changed or added |