Skip to main content

RateLimiter

tip

This should be constructed for each connection.

Constructs a middleware function with the settings you select.

local newLimiter = Ratelimiter(60, true)
--Or use it like this:
NeoNet:Connect("SomeEvent", function()
    --do something
end, RateLimiter(0.5, true))

--OR if you want to dynamically change the rate use it like this:
local limiterInfo = {60, true}
NeoNet:Connect("SomeEvent", function()
    --do something
end, RateLimiter(limiterInfo))
--later/somewhere else
limiterInfo[1] = 30

if you want to create your own middleware check out the docs page on it.

Show raw api
{
    "functions": [],
    "properties": [],
    "types": [],
    "name": "RateLimiter",
    "desc": ":::tip\nThis should be constructed for each connection.\n:::\n\nConstructs a middleware function with the settings you select.\n```lua\nlocal newLimiter = Ratelimiter(60, true)\n--Or use it like this:\nNeoNet:Connect(\"SomeEvent\", function()\n    --do something\nend, RateLimiter(0.5, true))\n\n--OR if you want to dynamically change the rate use it like this:\nlocal limiterInfo = {60, true}\nNeoNet:Connect(\"SomeEvent\", function()\n    --do something\nend, RateLimiter(limiterInfo))\n--later/somewhere else\nlimiterInfo[1] = 30\n```\n\nif you want to create your own middleware check out the docs page on it.",
    "source": {
        "line": 28,
        "path": "src/NeoNet/RateLimiter.lua"
    }
}