Closed kleisauke closed 6 years ago
Oh wow, that was quick. OK, I'll try to read through this.
That's great! It looks a lot better for you having polished it a bit.
I made some small comments -- the only big thing is "should get() / set() throw an exception?"
Exception handling is a little awkward in Lua, so I can see an argument for a simple error return. The idea was to have get_typeof()
and set_type() as the error-return ones, and
get()/
set()` as the exception ones, but that's a bit awkward too.
The reason I removed the exception that was thrown from get()
and set()
was because voperation
assumes that it returns a boolean, see:
https://github.com/jcupitt/lua-vips/blob/master/src/vips/voperation.lua#L217-L220
https://github.com/jcupitt/lua-vips/blob/master/src/vips/voperation.lua#L231-L234
In retrospect, this change isn't correct, because get()
does not check for return type, see:
https://github.com/jcupitt/lua-vips/blob/master/src/vips/voperation.lua#L254
https://github.com/jcupitt/lua-vips/blob/master/src/vips/voperation.lua#L262
https://github.com/jcupitt/lua-vips/blob/master/src/vips/voperation.lua#L273
Yes, I think get/set need revising to be more consistent.
Shall we merge this, then do a second pass to fix that up?
Sure, you may merge this. I've tried to fix the get/set on a different branch, see commit: https://github.com/kleisauke/lua-vips/commit/2211a4dc36e496a5ae6572bb0318bd49850a15de
Let me know if that looks better.
By the way, I saw that this repo is missing Travis CI. If you want, I could create a new PR to integrate Travis CI into this repo.
Sure, Travis would be great!
I'll have a look at your other branch.
Thanks for reviewing and merging this PR!
I've just made a PR for Travis CI integration, see: https://github.com/jcupitt/lua-vips/pull/26.
Hi John,
I had some time to cook up a PR (as requested in https://github.com/jcupitt/lua-vips/issues/24). For easier reviewing, I've split up the changes in multiple commits.
You could also consider to remove the
vips_argument_map
callback and change it to a pull-style API in libvips (because callbacks are slow in LuaJIT, see here). I already tried to do this (see https://github.com/kleisauke/lua-vips/commit/6d451f0493b788007fafeaf5a53c74547a0430d6), but haven't included it in this PR, because I'm not sure how the API should look like (and I'm not happy with thatVipsArgumentNameFlagsArray
struct, I think you'll find a better way).This PR includes
Code improvements
vips_value_set_blob_free
for libvips 8.6+ (because callbacks are slow in LuaJIT).setmetatable(Image, Image)
).self
log.table.insert
(replace it by using the#
operator instead).Bug fixes
vips_error_clear()
.msg_r
andprint_r
(avoid callingprettyprint_table
).Unit tests improvements