int n = lua_gettop(L);
if (n > 0) {
- if (!lua_isnumber(L, 1))
+ if (!lua_isnumber(L, 1) || n > 1)
lua_error_p(L, "expected 'max_ttl(number ttl)'");
uint32_t min = cache->ttl_min;
int64_t ttl = lua_tointeger(L, 1);
- if (ttl < 0 || ttl < min || ttl > UINT32_MAX) {
+ if (ttl < 1 || ttl < min || ttl > UINT32_MAX) {
lua_error_p(L,
"max_ttl must be larger than minimum TTL, and in range <1, "
STR(UINT32_MAX) ">'");
const char *errstr = "net.tls_padding parameter has to be true, false,"
" or a number between <0, " STR(MAX_TLS_PADDING) ">";
- if ((lua_gettop(L) != 1))
- lua_error_p(L, "net.tls_padding takes one parameter: (\"padding\")");
+ if (lua_gettop(L) != 1)
+ lua_error_p(L, "%s", errstr);
if (lua_isboolean(L, 1)) {
bool x = lua_toboolean(L, 1);
if (x) {