Page 1 of 1

on_entity_damaged damage_type returns __self = 0

Posted: Wed Jan 24, 2024 8:32 pm
by BubstyBoy
Whenever on_entity_damaged is called, if I try to get the damage type, it just returns this:

Code: Select all

  damage_type = {
    __self = 0
  },
does anyone know why it does this or how to get the damage type from it? Thanks!

Re: on_entity_damaged damage_type returns __self = 0

Posted: Wed Jan 24, 2024 9:35 pm
by Stringweasel
Is that while printing it using serpent? Or logging it? Looks like a LuaObject, which can't be printed.

Of you show your code it would be easier to help.

Re: on_entity_damaged damage_type returns __self = 0

Posted: Wed Jan 24, 2024 10:13 pm
by BubstyBoy
It is being logged in factorio-current.log

Re: on_entity_damaged damage_type returns __self = 0

Posted: Thu Jan 25, 2024 1:33 am
by FuryoftheStars
damage_type is a custom Lua object. You'll need to assign it to a var and then pull the specific value from it you are interested in.

https://lua-api.factorio.com/latest/cla ... otype.html

Re: on_entity_damaged damage_type returns __self = 0

Posted: Thu Jan 25, 2024 2:02 am
by BubstyBoy
Ok, thank you!