File tree Expand file tree Collapse file tree 1 file changed +23
-19
lines changed Expand file tree Collapse file tree 1 file changed +23
-19
lines changed Original file line number Diff line number Diff line change @@ -304,26 +304,30 @@ function dtutils.find_image_by_id(imgid)
304
304
if # dt .database == 0 or imgid > dt .database [# dt .database ].id then
305
305
return nil
306
306
end
307
- local min = 1
308
- local max = # dt .database
309
- while (max - min )// 2 > 0 do
310
- local mid = min + (max - min )// 2
311
- local midID = dt .database [mid ].id
312
- if imgid == midID then
313
- return dt .database [mid ]
314
- elseif imgid < midID then
315
- max = mid - 1
316
- else
317
- min = mid + 1
318
- end
319
- end
320
- if dt .database [min ].id == imgid then
321
- return dt .database [min ]
322
- elseif dt .database [max ].id == imgid then
323
- return dt .database [max ]
307
+ if dt .configuration .api_version_string >= " 6.3.0" then
308
+ return dt .database .get_image (imgid )
324
309
else
325
- return nil
326
- end
310
+ local min = 1
311
+ local max = # dt .database
312
+ while (max - min )// 2 > 0 do
313
+ local mid = min + (max - min )// 2
314
+ local midID = dt .database [mid ].id
315
+ if imgid == midID then
316
+ return dt .database [mid ]
317
+ elseif imgid < midID then
318
+ max = mid - 1
319
+ else
320
+ min = mid + 1
321
+ end
322
+ end
323
+ if dt .database [min ].id == imgid then
324
+ return dt .database [min ]
325
+ elseif dt .database [max ].id == imgid then
326
+ return dt .database [max ]
327
+ else
328
+ return nil
329
+ end
330
+ end
327
331
end
328
332
329
333
return dtutils
You can’t perform that action at this time.
0 commit comments