Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function echo(str)--Yeap, it has to be a global function
- io.write(str);
- end
- function ExecuteLuaTags(str, sOut)
- --[[returns true or nil + errmsg
- Arg1 = string HTMLwithLuaTags;
- Arg2 = outputFilepath]]--
- io.output(sOut);
- local ret, msg;
- local function ParseLuaTag(str)
- --By WeBuLtR@ hehehe
- if not str:find("%%>$") then
- str = str:gsub("(.+%%>)(.+)",
- function(a,b)
- return a.."echo([["..b.."]])";
- end
- );
- end
- str = str:gsub("(.-)<%%lua(.-)%%>",
- function(s,b)
- return "echo([["..s.."]]) "..b;
- end
- );
- return str;
- end
- local a,b = pcall(loadstring,ParseLuaTag(str));
- if a then
- ret, msg = pcall(b);
- else
- ret, msg = nil, b;
- end
- io.close();
- return ret, msg;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement