Question Details

No question body available.

Tags

recursion lua nmap

Answers (1)

January 26, 2026 Score: 2 Rep: 2,943 Quality: Low Completeness: 40%

Presumably, this is to speed up lookup times. In Lua, access speed is faster for locals than globals (as detailed in another Stack Overflow Q&A. If the function needs to be available globally but is performance-critical, leaving a global reference for external use and a local one for the actual recursion could improve performance.

Usually, the difference is pretty small, but I could absolutely see recursion being a legitimate use case; especially for a deeply-nested table, the small amount of time saved per call be meaningful. There's also not a huge downside since one more function reference shouldn't take much memory.