Page 1 of 1
Read access to LuaEntityPrototype.max_logistic_slots
Posted: Fri Aug 13, 2021 8:24 pm
by eradicator
I can see it in the prototype explorer but can't read it from the API. LuaEntity.filter_slot_count isn't an option because I need to know the maximum number of possible filters (which can be infinite).
Re: Read access to LuaEntityPrototype.max_logistic_slots
Posted: Sat Aug 14, 2021 12:12 pm
by curiosity
Re: Read access to LuaEntityPrototype.max_logistic_slots
Posted: Sat Aug 14, 2021 3:57 pm
by eradicator
Thank you very much! I must've had a mind-block because the prototype explorer shows it as max_logistic_slots.
Thead can be moved to "already exists".
Re: Read access to LuaEntityPrototype.max_logistic_slots
Posted: Sun Aug 15, 2021 7:03 am
by curiosity
There is about as much in common (if not less) between prototype explorer and data/control stage as between the stages themselves. So take what it shows with a grain of salt.
Re: Read access to LuaEntityPrototype.max_logistic_slots
Posted: Sun Aug 15, 2021 12:54 pm
by eradicator
curiosity wrote: ↑Sun Aug 15, 2021 7:03 am
There is about as much in common (if not less) between prototype explorer and data/control stage as between the stages themselves. So take what it shows with a grain of salt.
Not as bad as you make it sound, but I know what you mean. And I did ctrl+f "slot" and "logistic" all over the place because max slots not being exposed felt odd. Alas it somehow slipped through.
Re: Read access to LuaEntityPrototype.max_logistic_slots
Posted: Sun Aug 15, 2021 2:31 pm
by Rseding91
Yeah. The prototype explorer takes the internal variable name we use (the C++ variable name) and does this to it:
Code: Select all
std::string PrototypeExplorerWidgets::demangleMemberName(std::string_view name)
{
{
constexpr std::string_view key{ "this->" };
if (StringUtil::startsWith(name, key))
name = std::string_view(name.data() + key.size(), name.size() - key.size());
}
const std::string lower = StringUtil::toLowerCopy(name);
std::string result;
result += lower[0];
char last = ' ';
for (size_t i = 1; i < name.size(); ++i)
{
if (name[i] != lower[i])
if (last != 'i' || lower[i] != 'd')
result += ' ';
result += lower[i];
last = lower[i];
}
return result;
}
So, it sometimes matches the Lua API, sometimes matches the data stage names. Sometimes it's neither.