errors and warnings / types / E2030
E2030 error
API not available in every flavor (shared flavor mode), missing a flavor guard
- area
- types (x2xxx)
- fails the build
- yes
- in plain Lua files
- reported as W2030
Shared flavor mode only ("build": { "flavor-mode": "shared" }): one build
runs on several flavors, and this API doesn't exist on all of them. On a
flavor without it, the name is nil in game, and using it raises an error.
Guard the use with a flavor check (if flavor == "standard" then, a
WOW_PROJECT_ID comparison) or an existence check (if C_Garrison then).
In a plain Lua file it is the warning W2030.
Example
{ "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" }, "flavors": { "standard": {}, "vanilla": {} }, "build": { "flavor-mode": "shared" }}--!strictC_Garrison.GetGarrisonInfo(1){ "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" }, "flavors": { "standard": {}, "vanilla": {} }, "build": { "flavor-mode": "shared" }}--!strictif C_Garrison then C_Garrison.GetGarrisonInfo(1)endThe compiler reports it like this:
error[E2030]: `C_Garrison.GetGarrisonInfo` is not available in `vanilla`; guard it with a flavor check or an existence check ┌─ src/main.wowlua:2:12 │ 2 │ C_Garrison.GetGarrisonInfo(1) │ ^^^^^^^^^^^^^^^ here
Related codes
| code | message |
|---|---|
| W2030 | API not available in every flavor (shared flavor mode), missing a flavor guard (in a plain Lua file) |
Offline
$ wowlua explain E2030 E2030 (error): API not available in every flavor (shared flavor mode), missing a flavor guard