Read access to LuaEntityPrototype.max_logistic_slots
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Read access to LuaEntityPrototype.max_logistic_slots
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).
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Read access to LuaEntityPrototype.max_logistic_slots
Thank you very much! I must've had a mind-block because the prototype explorer shows it as max_logistic_slots.curiosity wrote: ↑Sat Aug 14, 2021 12:12 pm Then read it from the prototype: https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.filter_count
Thead can be moved to "already exists".
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Read access to LuaEntityPrototype.max_logistic_slots
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.
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Read access to LuaEntityPrototype.max_logistic_slots
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.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Read access to LuaEntityPrototype.max_logistic_slots
Yeah. The prototype explorer takes the internal variable name we use (the C++ variable name) and does this to it:
So, it sometimes matches the Lua API, sometimes matches the data stage names. Sometimes it's neither.
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;
}
If you want to get ahold of me I'm almost always on Discord.