lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Apr 14, 2014 at 2:55 AM, Sean Conner <sean@conman.org> wrote:
>   As for monkeypatching, yes, you can do it.  But it's not that common in
> the Lua community (thank God!) and for good reason: you cannot reason about
> monkeypatched code!

Lol don't listen to Sean, he's crazy :p  Monkeypatching rules!
Everybody's doing it... wanna hit?

No, but in seriousness monkeypatching can be both a gift and a curse.
Usually I only do this when I'm writing code for myself because I know
in what way I might have modified table.insert() to accept a vararg.
It's easier to understand if you're adding functions rather than
redefining them, but he's right that it makes it more difficult for
third-parties to figure out how Lua has changed for you.  I wouldn't
say "don't do it", but I would say "don't go crazy" :-)  It has it
place in moderation.

Practically everyone in Lua 5.1/5.2 wrapped table.concat() to call
tostring() on the table elements anyway.  Some monkeys think alike :-)