data.lua and control.lua
data.lua and control.lua
I generated a table in data.lua based on recipes of item prototypes. I want to be able to use that table in control.lua. How do I do that?
Re: data.lua and control.lua
The runtime control script is in a different context. You can access prototypes in the game/LuaGameScript object.
Re: data.lua and control.lua
Okay, so I'm getting this error:
I referred to https://lua-api.factorio.com/latest/ and https://lua-api.factorio.com/latest/LuaGameScript.html, which led me to believe that referencing "game" in control.lua should work. Why doesn't it?
EDIT: Oops, I missed this: "It is, however, not available inside handlers registered with LuaBootstrap::on_load." Thank you, SyncViews. I know what I can do now.
Code: Select all
control.lua:131: attempt to index global 'game' (a nil value)
EDIT: Oops, I missed this: "It is, however, not available inside handlers registered with LuaBootstrap::on_load." Thank you, SyncViews. I know what I can do now.