lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>   function instance:htmlize_link(link)
	This declaration is equivalent to:

function instance.htmlize_link (self, link)

	So, this function needs two parameters: an object and a link!

>     -- This is the statement that doesn't work
>     self.Data = gsub(self.Data, "%[([^]]*)%]", self.htmlize_link)
	Here you only have one capture, so the function will be
called as:

self.htmlize_link (<capture>, nil)

	To solve this, you should create another function:

self.Data = gsub(self.Data, "%[([^]]*)%]", function (link)
	%self.htmlize_link (%self, link)
end)

	On the other hand, the function htmlize_link doesn't
need the object and you can redefine it:

function instance.htmlize_link (link)

	And maintain the same gsub call.
		Tomas