Re: Error handling with pipmak.getimage/pipmak.newimage
Status: Alpha
Brought to you by:
cwalther
From: Christian W. <cwa...@gm...> - 2009-07-20 17:15:40
|
Andrea Viarengo wrote: > is there a reason why standard lua error handling functions doesn't work with > pipmak.getimage/pipmak.newimage? I don't think there is a particular reason, except that it has historically evolved that way. > I.e. in the code: > > local success,errcode = pcall(function() pipmak.getimage("test.png") end) > > variable success is always true both is test.png exists or not, > and an error message is printed out!! > > I would like to have a behaviour like this (in pseudo-code): > > if image1 exists then > load image1 > else > load image2 > end > > and, off course, without any error message printing! I agree that this could be useful. What's important is that when you write patch { image = "test.png" } and test.png doesn't exist, that shouldn't cause the whole node loading operation to fail, but load the "question mark" image instead and print a warning. It seems to me that this could still be achieved with a getimage() that uses standard Lua error handling, so I currently see no reason not to change it. -Christian |