Code: Select all
Hello world.
Code: Select all
Hello big world.
Code: Select all
Hello big wo
It seems to all work fine in my PC's Lua interpreter, so I suspect the bug may be somewhere within LuaPlayer. Any ideas?
Here's the code for the portion of the app that loads the file...anything else I make of the sort exhibits the same problem.
Code: Select all
function parse_lhp(fname)
output = ""
code = ""
res = ""
cp = false
lines = nil
line = nil
file = io.input(fname, "rb")
for line in io.lines() do
if string.find(line, "%<%?") ~= nil then
cp = true
end
if cp == true then
if string.find(line, "%<%?") == nil and string.find(line, "%?%>") == nil then
code = code .. line
end
else
output = output .. line
end
if string.find(line, "%?%>") ~= nil and cp == true then
cp = false
res = run_lua(code)
output = output .. res
end
end
file:close()
return output
end
function run_lua(code)
local result,err = loadstring(code)
if not result then
return "<br />Error: " .. err
else
result, err = pcall(result)
if not result then
return "<br />Error: " .. err
else
return "<br />Parsed."
end
end
end