[2.0.5] LuaPlayer::cursor_ghost read type specification

robot256
Filter Inserter
Filter Inserter
Posts: 948
Joined: Sun Mar 17, 2019 1:52 am
Contact:

[2.0.5] LuaPlayer::cursor_ghost read type specification

Post by robot256 »

In the documentation for LuaPlayer::cursor_ghost, the Read type is said to be "ItemIDAndQualityIDPair", which contains "ItemID" and "QualityID" types. The problem is that those are both unions of several different Lua objects and plain string names. It isn't clear from the documentation that in fact what you get is always "LuaItemPrototype" and "LuaQualityPrototype". To get the string name of the item, for example, you have to write "player.cursor_ghost.name.name". This is different from 1.1 and old code will fail silently if not updated (comparing a string to a LuaItemPrototype object).

It would be nice if the documentation specified this more explicitly, or if the "name" field was changed to "item" or something.
User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 261
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: [2.0.5] LuaPlayer::cursor_ghost read type specification

Post by Therenas »

Good point, noted for the next release!
Post Reply

Return to “Resolved Requests”