v0.13.8
errors and warnings / names

errors and warnings / names / W1003

W1003 warning

Unused local, parameter or import

area
names (x1xxx)
fails the build
with --deny-warnings

A local, parameter, loop variable or import is never read. It is often a leftover of a refactoring, or a sign that the wrong name is used somewhere. Remove it, or start its name with _ (_event) to keep it on purpose, as for a callback parameter you must accept but don't need. Like every lint, its level can be changed in the manifest's check.lints ("W1003": "allow").

Example

× failswowlua
local function greet(name: string, title: string)    print("Hello " .. name)endgreet("Ana", "Dr.")
✓ compileswowlua
local function greet(name: string, _title: string)    print("Hello " .. name)endgreet("Ana", "Dr.")

The compiler reports it like this:

warning[W1003]: unused parameter `title`
  ┌─ src/main.wowlua:1:36
  │
1 │ local function greet(name: string, title: string)
  │                                    ^^^^^ never read
  │
  = help: prefix it with `_` (`_title`)

Offline

terminal
$ wowlua explain W1003
W1003 (warning): Unused local, parameter or import

source on GitHub ↗