[2.0.5] Entity damage has weird parameters

BurninSun
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Fri Mar 16, 2018 4:54 am
Contact:

[2.0.5] Entity damage has weird parameters

Post by BurninSun »

/doc-html/classes/LuaEntity.html#damage
10-18-2024, 01-09-42.png
10-18-2024, 01-09-42.png (66.64 KiB) Viewed 151 times
This indicates type is optional and has a default, yet can't be nil?

I'm assuming this was intended to make `type` optional in the parameter list though it is somewhat unclear on that. Also if type is optional, the following should still be valid:

`p.damage(1, "player", "electric", p, p)` however this results in the error: Expected between 2 and 4 argument but 5 were given.

This could use some clarification on valid parameters.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3052
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.5] Entity damage has weird parameters

Post by boskid »

Changed the docs (for 2.0.6) to not state it cannot be nil. It can be nil but a default value will be used instead.
Post Reply

Return to “Resolved Requests”