errors and warnings / stdlib / E8030
E8030 error
Deferred-call decorator on a function that returns values
- area
- stdlib (x8xxx)
- fails the build
- yes
@throttle, @debounce and @nextFrame from wowlua:timer, and
@outOfCombat from wowlua:combat, may run the function later than it was
called, or merge several calls into one. The caller never gets a result back,
so the decorated function must not return values.
Remove the return values. If the caller needs a result, pass it on another
way, such as a field the function sets or a callback it calls.
Example
import throttle from "wowlua:timer" @throttle(0.5)local function refresh(): boolean print("refresh") return trueendrefresh()import throttle from "wowlua:timer" @throttle(0.5)local function refresh() print("refresh")endrefresh()The compiler reports it like this:
error[E8030]: `@throttle` may run the function later, so it must not return values ┌─ src/main.wowlua:3:1 │ 3 │ @throttle(0.5) │ ^^^^^^^^^^^^^^ defers the call
Offline
$ wowlua explain E8030 E8030 (error): Deferred-call decorator on a function that returns values