On 01/29/2011 05:04 AM, Will Robertson wrote:


Is there any way to make this quieter? (Can lua files be loaded from
lua without being printed in the console output?)

Yes, by using loadfile() instead of require().

Something like this:

_LOADED = _LOADED or {}
function silentrequire (file)
   if _LOADED[file] == nil then
     local fname = kpse.find_file(file .. ".lua")
     if fname then
       local data = loadfile(fname)
       if data then
         _LOADED[file] = true
         data() -- run the chunk
       end
     end
   end
end

Reply via email to