Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tables with circular keys crash lune when printed #179

Closed
Hexcede opened this issue Apr 15, 2024 · 4 comments · Fixed by #183
Closed

Tables with circular keys crash lune when printed #179

Hexcede opened this issue Apr 15, 2024 · 4 comments · Fixed by #183
Labels
bug Something isn't working

Comments

@Hexcede
Copy link

Hexcede commented Apr 15, 2024

I apologize if this is potentially an issue with mlua and I have misreported it, I wasn't able to debug further than this.

Tables with themselves as keys immediately crash lune with the following stack trace when printed to the console.

thread 'main' has overflowed its stack
fatal runtime error: stack overflow

This only happens with tables that have themselves as keys. Any other sort of circular pattern works fine as long as a key does not contain a table higher in the heirarchy.

Reproduction:

local circularValues = {}
circularValues.Self = circularValues

print(circularValues) -- Works as expected, prints { Self = <self>, }

local circularKeys = {}
circularKeys[circularKeys] = "Self"

print(circularKeys) -- Crashes lune, expect to see { [<self>] = "Self", } instead but lune appears to try to print the full table again inside the key
@filiptibell filiptibell added the bug Something isn't working label Apr 16, 2024
@CompeyDev
Copy link
Contributor

I might've overlooked this in #158, I'll investigate more and find out.

@CompeyDev

This comment was marked as outdated.

@CompeyDev
Copy link
Contributor

I figured it out; turns out we're not incrementing the depth on this call to pretty_format_value.

@SnorlaxAssist
Copy link
Contributor

SnorlaxAssist commented Apr 17, 2024

Similar issue to #156

Edit: Seems like the issue wasn't actually solved :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants