Is it possible to add a prototype via console? Eg, want to add a custom input.
calling data:extend just says there is no data global, but perhaps there is another, even if hacky way to do this.
It'd be nice to do through console so I can share /c snippets with others without having them to go through the modding hoops.
eg: https://wiki.factorio.com/Console
Console data:extend
-
- Filter Inserter
- Posts: 665
- Joined: Wed Sep 16, 2020 12:45 pm
- Contact:
Console data:extend
OptimaUPS Mod, pm for info.
Re: Console data:extend
No, the data table is destroyed after the game starts. You can't create prototypes from the console.
The console only supports stuff you can do in control.lua, which is documented here: https://lua-api.factorio.com/latest
The console only supports stuff you can do in control.lua, which is documented here: https://lua-api.factorio.com/latest
-
- Filter Inserter
- Posts: 665
- Joined: Wed Sep 16, 2020 12:45 pm
- Contact:
Re: Console data:extend
The data table is destroyed? Not copied or cloned? I guess private variables are private.
Shame. I don't really want to publish mods, but I don't mind sharing code.
Shame. I don't really want to publish mods, but I don't mind sharing code.
Last edited by blazespinnaker on Sat Feb 13, 2021 10:07 pm, edited 1 time in total.
OptimaUPS Mod, pm for info.
Re: Console data:extend
https://lua-api.factorio.com/latest/Data-Lifecycle.htmlblazespinnaker wrote: ↑Sat Feb 13, 2021 10:04 pmThe data table is destroyed? Curious how you know that. Any links / code describing that process?
-
- Filter Inserter
- Posts: 665
- Joined: Wed Sep 16, 2020 12:45 pm
- Contact:
Re: Console data:extend
Yeah, I had read that, but I didn't really interpret that being the data table being destroyed. I would have assumed it would have at least been cloned somewhere.darkfrei wrote: ↑Sat Feb 13, 2021 10:05 pmhttps://lua-api.factorio.com/latest/Data-Lifecycle.htmlblazespinnaker wrote: ↑Sat Feb 13, 2021 10:04 pmThe data table is destroyed? Curious how you know that. Any links / code describing that process?
OptimaUPS Mod, pm for info.
Re: Console data:extend
I'm sure it has been, but for the C++ code. No longer needs to exist in Lua.blazespinnaker wrote: ↑Sat Feb 13, 2021 10:08 pmYeah, I had read that, but I didn't really interpret that being the data table being destroyed. I would have assumed it would have at least been cloned somewhere.
-
- Filter Inserter
- Posts: 665
- Joined: Wed Sep 16, 2020 12:45 pm
- Contact:
Re: Console data:extend
Perhaps, though you could theoretically say that about a lot of the datastructures.
One issue I realize now on further reading is desync. Looks like a lot of obvious apis are missing as they would cause issues in MP, though I imagine custom input would be OK.
One issue I realize now on further reading is desync. Looks like a lot of obvious apis are missing as they would cause issues in MP, though I imagine custom input would be OK.
OptimaUPS Mod, pm for info.