lua-users home
lua-l archive

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


>> I used it in my project [1] and it seems to work fine. The only detail
>> is
>> that the multipart.Request method errors if you pass
>> it a non-string or table value (see helpers.lua, line 83). It should do
>> a
>> tostring() on the value if it's not a string or table.
>
> Thanks, I'll take a look at it.

I have seen you have changed that here [1]. Considering if I should change
it in lua-multipart-post as well.

I do not like the idea of calling tostring() on what is passed to that
function independently of its type. For numbers it probably makes sense,
but passing nil is almost certainly an error. And if you pass a function
you probably don't want to call tostring() on it but rather to call it and
use the result as the value...

So I think this makes the code more fragile. I would rather just deal with
numbers and keep erroring out in other cases (maybe not using error() if
you prefer to handle errors differently in your code, e.g. by returning
nil).

Thoughts?

[1]
https://github.com/ignacio/LuaOAuth/commit/b5d0674cf9c301b4340b4d046e8ba041f69019ab