bartbes / love-misc-libs

Just some random libs I have lying around, now with version control!
http://docs.bartbes.com
110 stars 28 forks source link

Fix port arguments in string form (grease) #19

Closed obskyr closed 7 years ago

obskyr commented 7 years ago

As it turns out, grease (and, by extension, LUBE) supports providing the port argument for server:listen as a string. However, if you provide the port as a string for client:connect, it fails silently! It just simply never receives any data, due to a failing == comparison. I spent literal hours chasing this one down...

This pull request calls tonumber on the port arguments in both places, for consistency. It also preserves backwards compatibility by doing so.

bartbes commented 7 years ago

Thanks for the PR! Though, technically it's luasocket (and lua-enet?) that converts it to a number ;).

You mentioned adding tonumber in both places, yet I only see one added tonumber, did you forget to commit the other one (presumably in server:listen)?

obskyr commented 7 years ago

I'm a bit tired, as it turns out - I'd fixed it on my end but not in the PR. Whoops. Fixed it now though!

The library could honestly do with 5 tons more documentation, too, hahah, but I suppose that's for another time.