I want to use mongoose for my project.The example of lua like prime_numbers.lp or page.lp runs very well.
But when I load file data or run some shell cmd,there is no anything output, except my "hhhh" here. What's wrong and how can I operate file using lua server page?
Thanks.
$ ./mongoose-lua -v
Loading config file ./mongoose.conf
Mongoose version 4.2 (c) Sergey Lyubka, built on Oct 29 2013
my test.lp is here:
----------------------------------------
function scandir(directory)
mg.write("hhhh")
local i, t, popen = 0, {}, io.popen
for filename in popen('ls "'..directory..'"'):lines() do
mg.write("bbbb")
i = i + 1
t[i] = filename
mg.write(filename)
end
return t
end
mg.write(scandir("."))
-------------------------------------
local count = 0
_G.entry = function(_) count = count + 1 end
local f, error = loadfile('entry.lua')
mg.write('error:' .. error .. '\n')
mg.write('path:' .. script_path() .. '\n')
-- getfenv(f).entry = entry
f()
mg.write("number of counts:" .. count)
entry.lua file is here:
-----------------------------
entry{
"author1",
"name1",
"1997"
}