LuaControl.opened can read open entities but with armor/blueprint books/... it returns nil. Considering there's no other way to find which item is open (or at least I didn't find any), I'd say it would be logical and useful to add this option. It would be fine (albeit not very elegant) to add this as a separate method (like LuaControl.opened_item) if you're worried about mods being broken by this.
Thanks TRK
LuaControl.opened read with items
- theRustyKnife
- Filter Inserter
- Posts: 259
- Joined: Thu Feb 26, 2015 9:26 pm
- Contact:
Re: LuaControl.opened read with items
It's currently not possible to know where the opened item is located which is why it's not possible to get a reference to it in Lua.
The opened item could be in your inventory (most likely) or it could be located on the other side of the map in a robot or even a player that has logged off the game 6 hours ago.
The opened item could be in your inventory (most likely) or it could be located on the other side of the map in a robot or even a player that has logged off the game 6 hours ago.
If you want to get ahold of me I'm almost always on Discord.
- theRustyKnife
- Filter Inserter
- Posts: 259
- Joined: Thu Feb 26, 2015 9:26 pm
- Contact:
Re: LuaControl.opened read with items
Pardon my ignorance, but why would that prevent getting a reference to the item? I would think the game has to know the item since it is being manipulated.
Re: LuaControl.opened read with items
The game knows where the item is located in memory - it doesn't know where the item stack is located. The LuaItemStack class operates on item stacks.
If you want to get ahold of me I'm almost always on Discord.