API FindAndReplaceTagsCB

From Vendetta Lua
Jump to navigationJump to search

FindAndReplaceTagsCB

Definition:
FindAndReplaceTagsCB(string text, function cb) -> string ret1
Description:
Pass each occurances of with < and > enclosed substrings in text to cb and replace them with the return value
Arguments:
test string to replace tags in
cb called with the content of each tag as argument
Returns:
ret1: converted text
Example:
<source lang="lua"> local function find_cb(t)

     if t == "br" then
     	 return "\n"
     end

end FindAndReplaceTags("hi this is a
linebreak", find_cb)
-> "hi this is a linebreak"</source>