Page 1 of 1
player.cursor_ghost.name is LuaItemPrototype?
Posted: Thu Dec 12, 2024 10:44 pm
by ownlyme
I'm not sure if this is a bug, but sometimes the .name field doesnt contain the name, but an object...
for example for player.cursor_ghost
you'd expect .name to be a string, right?
Re: player.cursor_ghost.name is LuaItemPrototype?
Posted: Fri Dec 13, 2024 5:03 am
by robot256
It's weird that it's called "name", but that's the intended behavior. I found it a while ago and they updated the docs.
See:
https://lua-api.factorio.com/latest/con ... DPair.html
Linked from:
https://lua-api.factorio.com/latest/cla ... rsor_ghost
Re: player.cursor_ghost.name is LuaItemPrototype?
Posted: Fri Dec 13, 2024 7:53 pm
by ownlyme
so when you wanna read the name you write "something.name.name" ? kinda weird but ok
especially since it's inconsistent
Re: player.cursor_ghost.name is LuaItemPrototype?
Posted: Sat Dec 14, 2024 4:40 am
by robot256
Yup that's right. I agree it really ought to be named "item" or something like that. And so far only seems to affect cursor_ghost?
Re: player.cursor_ghost.name is LuaItemPrototype?
Posted: Sat Dec 14, 2024 9:36 am
by gangerM
I made a similar bug report a while ago;
123575
Here it is that get_filter(1) gives a prototype for a name or a string depending on the type of entity it is called on, I did not realize there were other cases.
Re: player.cursor_ghost.name is LuaItemPrototype?
Posted: Tue Dec 17, 2024 3:09 pm
by ownlyme
https://lua-api.factorio.com/latest/cla ... ly_burning
currently_burning.name is also item prototype
meanwhile that.burnt_result.name is a string again.
this is ridiculous