LuaControl.opened read with items

Things that we aren't going to implement
Post Reply
User avatar
theRustyKnife
Filter Inserter
Filter Inserter
Posts: 259
Joined: Thu Feb 26, 2015 9:26 pm
Contact:

LuaControl.opened read with items

Post by theRustyKnife »

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

Rseding91
Factorio Staff
Factorio Staff
Posts: 13253
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: LuaControl.opened read with items

Post by Rseding91 »

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.
If you want to get ahold of me I'm almost always on Discord.

User avatar
theRustyKnife
Filter Inserter
Filter Inserter
Posts: 259
Joined: Thu Feb 26, 2015 9:26 pm
Contact:

Re: LuaControl.opened read with items

Post by theRustyKnife »

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.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13253
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: LuaControl.opened read with items

Post by Rseding91 »

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.

Post Reply

Return to “Won't implement”