Skip to content

Separating globals for files that run in different Lua States #119

@justarandomgeek

Description

@justarandomgeek

Factorio mods use one shared Lua state (and thus do share globals) for some startup work and then one Lua state per mod (and thus do not share globals) at runtime. The Intellisense currently just assumes everything in the workspace shares one set of globals. For the most part this works okay, since we generally just don't refer to the objects from other "stages", and I don't generally create any new globals. However, Factorio provides a global table named global (a unique one per mod) for us to persist data in the save file, and my workspace has multiple mods in it, so the autocomplete for global is the union of all the open mods globals!

Also, the "defined globals" list really needs to vary per-file, because data-stage has a ton of globals while runtime has only a handful.

Is there any way to indicate these different sets of global variables?

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat/LuaCats AnnotationsRelated to Lua Language Server Annotations (LuaCats)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions