factoriolib / flib

A set of high-quality, commonly-used utilities for creating Factorio mods.
https://mods.factorio.com/mod/flib
MIT License
61 stars 15 forks source link

table.map implementation does not match documentation #33

Closed Zomis closed 3 years ago

Zomis commented 3 years ago

In table.map it says:

Calls mapper(value, key, tbl) on each element in the table, using the return as the new value for the key. (...) @tparam function mapper Takes in value, key, and tbl as parameters.

But the implementation does not match this:

https://github.com/factoriolib/flib/blob/master/table.lua#L277

output[k] = mapper(v, k) (the third parameter, for table, is never passed)

Either the implementation should change, or the documentation.

raiguard commented 3 years ago

Thanks, I fixed some other places in table where the docs included that third parameter.