}
-- New extended interface
+-- %<number> means numeric arguments and %s means the next argument
+-- for example %1, %2, %s: %s would mean the third argument
-rspamd_logger.infox('a=%1, b=%2, c=%3, d=%4, e=%5', a, b, c, d, e)
+rspamd_logger.infox('a=%1, b=%2, c=%3, d=%4, e=%s', a, b, c, d, e)
-- Output: a=string, b=1.50000, c=1, d={[1] = aa, [2] = 1, [3] = bb} e={[key]=value, [key2]=1.0}
-- Legacy interface (can handle merely strings)
lua_pushstring (L, "__index");
lua_gettable (L, -2);
- lua_istable (L, -1);
lua_pushstring (L, "class");
lua_gettable (L, -2);
s = lua_tostring (L, fmt_pos);
c = s;
- cur_arg = fmt_pos + 1;
+ cur_arg = fmt_pos;
if (s == NULL) {
return 0;
arg_num = strtoul (c, NULL, 10);
arg_num += fmt_pos - 1;
/* Update the current argument */
- cur_arg = arg_num + 1;
+ cur_arg = arg_num;
}
else {
/* We have non numeric argument, e.g. %s */
{'%1', '{[1] = 1, [2] = test}', {1, 'test'}},
{'%1', '{[k1] = 1, [k2] = test}', {k1=1, k2='test'}},
{'%1', '{[1] = 1, [2] = 2.100000, [k2] = test}', {1, 2.1, k2='test'}},
+ {'%s', 'true', true},
}
for _,c in ipairs(cases) do