Skip to content

Bug-Hunter-X/Lua-Stack-Overflow-in-Recursive-Table-Traversal-d7j4w

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Lua Stack Overflow Bug

This repository demonstrates a common Lua bug involving stack overflow errors in recursive functions that traverse tables. The bug.lua file contains a function that recursively iterates through a table. If the table contains cycles (a table referencing itself), or is excessively deep, the function will cause a stack overflow.

The bugSolution.lua file provides a solution that prevents this by tracking visited tables and avoiding cycles.

About

Lua stack overflow error caused by recursive function traversing a deeply nested or self-referential table. The recursive function `foo` does not check for cycles, leading to infinite recursion if a table contains itself as a value.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages