Hello, I need to identify number of pages by Lua of an image which is to be inserted.
The image can be of all various types supported by Ctx - e.g. .png, .pdf. I've been using the following code so far (based on a mailing thread in the past): ---- function nOfPages(fn) local fig = figures.push{name = fn} local info = figures.identify() figures.check() local n = fig.used.pages figures.pop() return n end ---- But the code above break Ctx in the case that the image doesn't exist. I'd need to modify the solution somehow so to return 'nil' or 'false' (or a error message) in the case the file was not found. How to do it? TIA. Best regards, Lukas (NB: Still "ConTeXt ver: 2012.11.26 13:31 MKIV fmt: 2012.11.27 int: english/english".) -- Ing. Lukáš Procházka [mailto:l...@pontex.cz] Pontex s. r. o. [mailto:pon...@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038 ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________