Skip to content

Need warning for Globals in module scope #893

@Yakehira

Description

@Yakehira

Seems recently global-in-non-module was added, need error opt-in for Globals in module scope, because we don't want any accidentally leaked in the env, in the world of warcraft env globals are leaked through out the entire game, so we can't leak globals (they need unique names if we do).

in luacheck we can use 111 to check.

local abc = 1 -- no error
global1 = 2 -- should error unless allowed/line disabled when opted into errors

local function foo()
  global1 = 1 -- error, unless the root variable was allowed/line disabled (in the module scope)
  abc = 10 -- no error
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions