diff --git a/doc/lua-api/index.rst b/doc/lua-api/index.rst index c16a07e6c..e0afaffcd 100644 --- a/doc/lua-api/index.rst +++ b/doc/lua-api/index.rst @@ -3558,7 +3558,7 @@ Patref class :param string key: the string used as a key :param string value: the string used as value - :param bool force: create the entry if it doesn't exist (optional, + :param boolean force: create the entry if it doesn't exist (optional, defaults to false) :returns: true on success and nil on failure (followed by an error message) diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c index 3118e40d5..b6252fbf1 100644 --- a/src/hlua_fcn.c +++ b/src/hlua_fcn.c @@ -2889,7 +2889,7 @@ int hlua_patref_set(lua_State *L) value = luaL_checkstring(L, 3); if (lua_gettop(L) == 4) - force = lua_tointeger(L, 4); + force = lua_toboolean(L, 4); HA_RWLOCK_WRLOCK(PATREF_LOCK, &ref->ptr->lock); if ((ref->flags & HLUA_PATREF_FL_GEN) &&