Trying to understand why Akira-san had written :
local function is_texlive ()
local a = kpse.var_value ('command_line_encoding')
if a
then
return true
else
return false
end
end
rather than
local function is_texlive ()
local a = kpse.var_value ('command_line_encoding')
return a
end
and similarly later on in the code, I tried modifying the source but ended up with
diagnostics that I did not understand. So, to try to make life simpler, I factored out
the Lua code into a separate file and tried running it from the command line. But even
using Akira-san's original code (with Reinhard's suggested simplification), I still get
unexpected results. Could a Lua expert possibly explain why OFILE is reporting 'nil' for
"grüße.tex", please ? Both are in the directory from which I am issuing the
TeXLua command.
/Philip Taylor
--------
/
local function is_texlive ()
local a = kpse.var_value ('command_line_encoding')
if a
then
return true
else
return false
end
end
local function is_windows()
if os.type == 'windows' then
return true
end
end
function myfilesize (name)
kpse.set_program_name ("luatex")
local ofile = kpse.find_file (name, "tex", true)
print (" OFILE: ", ofile)
local file = ofile
print (" FILE: ", file)
if is_windows () and is_texlive ()
then
local g = chgstrcp.utf8tosyscp (file)
file = g
end
print (" FILE: ", ofile)
if file
then
local size = lfs.attributes (file, "size")
local isfile= lfs.isfile (file)
print ("SIZE: ", size)
print ("isfile ", isfile)
end
end
myfilesize ("gruesse")
myfilesize ("grüße")
--[[ myfilesize ("大豊饒諸衆善法") ]]