-------- Forwarded Message --------
Subject: Re: [NTG-context] Lua: check if file exists
Date: Tue, 14 Oct 2025 19:17:03 +0200
From: Hans Hagen <[email protected]>
To: Henning Hraban Ramm <[email protected]>

On 10/14/2025 6:53 PM, Henning Hraban Ramm wrote:
Hi again,
Lua has no function to check if a file exists.
ATM I’m using this:

function userdata.file_exists(name)
   local f=io.open(name,"r")
   if f~=nil then io.close(f) return true
   else return false end
end

Is there anything (better) in ConTeXt?

to grep or not to grep ...

io.exists(filename)
lfs.isfile(filename)

and some more, depending on needs

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to