errors and warnings / debugging / E7001
E7001 error
nameof argument is not a name, field access or string-keyed index
- area
- debugging (x7xxx)
- fails the build
- yes
nameof from wowlua:debug folds to the last name of its argument at
compile time (nameof(Tracker.record) is "record"), so the argument must be
a name, a field access or an index with a string key. A call, a literal or an
index with a computed key has no name to give. Pass the name itself.
Example
import nameof from "wowlua:debug" local function onLogin() endprint(nameof(onLogin()))import nameof from "wowlua:debug" local function onLogin() endprint(nameof(onLogin))The compiler reports it like this:
error[E7001]: `nameof` needs a name, a field access or an index with a string key ┌─ src/main.wowlua:4:7 │ 4 │ print(nameof(onLogin())) │ ^^^^^^^^^^^^^^^^^ here
Offline
$ wowlua explain E7001 E7001 (error): nameof argument is not a name, field access or string-keyed index