Prototype properties as functions?

Place to get help with not working mods / modding interface.
Vulcan
Long Handed Inserter
Long Handed Inserter
Posts: 52
Joined: Sat Aug 02, 2014 12:34 pm
Contact:

Prototype properties as functions?

Post by Vulcan »

I'm going to guess that setting the property of a prototype as a function to be determined at runtime is not possible, like this:

Code: Select all

  {
    type = "item",
    name = "an-item",
    icon = "__modmodmod__/graphics/icons/thing.png",
    stack_size = some_function()
  }
As I said, I don't think this will work but I'd like confirmation because it would make my life easier if it did, but I don't want to go marching off down a dead end if it can be avoided

Thanks!
Zeblote
Filter Inserter
Filter Inserter
Posts: 973
Joined: Fri Oct 31, 2014 11:55 am
Contact:

Re: Prototype properties as functions?

Post by Zeblote »

Well, it does work, but the function will be evaluated when creating the prototype. So it probably doesn't do what you want?
Vulcan
Long Handed Inserter
Long Handed Inserter
Posts: 52
Joined: Sat Aug 02, 2014 12:34 pm
Contact:

Re: Prototype properties as functions?

Post by Vulcan »

That's what I thought, my question referred to the function being evaluated each time the property is accessed, rather than once when all the prototypes are created.
Thanks for clearing this up!
Post Reply

Return to “Modding help”