GLON, infinite loops and debug.SetHook

What is wrong with this code?



    local h_a, h_b, h_c = debug.gethook()
    debug.sethook()
    local write = glon.encode(variable)
    debug.sethook(h_a, h_b, h_c)
    file.Write("file.txt", write)

It gives this error:

:74: bad argument #1 to ‘sethook’ (function expected, got string)

What in the name of Garry are you trying to do?

how exactly is encoding glon giving an infinite loop? O.o

Notes section of GLON

Have you tried it without the debugset/get ?

Yes, that’s what I had from the beginning. After a while the variable (which is a large table) became too big, and it popped out an infinite loop error. That’s why I added the debug things I found on the wiki, and now it gives me the said error.

-HP- If your table keeps getting bigger and bigger then you might be adding duplicate values into your table, what is the code that is adding to the table

That’s not the problem, the point is that it is a large table, and it gives infinite loop error when GLON’d.

Content doesn’t matter at all.

Garry should lower the infinite loop security a bit.

I have been getting the same error while trying to prevent infinite loop errors also, but only recently.

Maybe Garry broke something?

Anyone else having this problem?

Is there any other way to avoid the infinite loop error, or should I just split up the array and save it to different text files, and merge it again when it is loaded?
No, wait, that would also give infinite loop error, since I’ll have to use a loop to load the txt files :frowning:

bump

Another bump, I need a solution for this. Will the table keyvalue functions work, or do they too give infinite loop errors if the table is too big? I’m talking a very large table here.

Mind telling us why the table is so large in the first place? Perhaps there is a more effective way of doing it?

The table is so large because it stores data for a chatbot, and I don’t think there is a much more efficient way of doing it.

util.TableToKeyValues should not have problems with inf. loop protection, try using that. It does the same thing that glon does except it only has the ability to only store text and numbers, which should be the only things you are using.

Thank you, I will use that then. I am only using text and numbers, so that is perfect.