Unknown error

Draw:143: reference cycle
stack traceback:
	[C]: in function 'error'
	...F01872CADB0/Codea.app/RuntimeResources.bundle/dkjson.lua:365: in function 'dkjson.encode'
	Draw:143: in field 'Draw'
	Main:10: in function 'draw'

I don’t have a function ‘error’

Here is the failing function:

function Alert.fromHTML(str)
    local n = {}
    for a in string.gmatch(str, "<b>.-</b>") do
        a = a:gsub("<b>", "")
        a = a:gsub("</b>", "")
        n = Alert.fromHTML(a)
        table.insert(n, n)
        str = str:gsub(str, a)
    end
    return n
end

I was calling the function something like Alert.Open("Test Text <b>Test Bold</b>", "Test Alert")

I am currently working on something and I have currently only b in the function, that’s why if you ask.

If I comment out the Alert line it works for me. No errors and I get what I think is correct. If you have problems, then comment out lines and figure out what’s wrong line by line.

But I’ will have more tags b,i, u, img, etc. and I want to redirect to the function again

I don’t know why, but Json.encoded didn’t supported the returned value :confused: