Page 1 of 1

[2.0.5] LuaPlayer::cursor_ghost read type specification

Posted: Fri Oct 18, 2024 2:47 am
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.

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

Posted: Mon Oct 21, 2024 12:45 pm
by Therenas
Good point, noted for the next release!