Fixes Issue #72: Add Missing Third Parameter to lua_gc Function#73
Fixes Issue #72: Add Missing Third Parameter to lua_gc Function#73Va16hav07 wants to merge 2 commits intoagraef:masterfrom
Conversation
Updated lua_gc calls to include the third parameter. Ensured proper function signature compliance with Lua 5.3.
|
@agraef Please review |
|
Ah yes, that line was recently added by @timothyschoen, probably it was part of Tim's giant changeset that implemented the graphics support. Have you tried whether this fix still works when compiling against Lua 5.4? I can't seem to find any information about what the 3rd parameter is supposed to be in the Lua 5.3 docs. |
|
@agraef I have checked it for Lua 5.4 and added a conditional to ensure compatibility with both Lua 5.4 and Lua 5.3. |
|
It caters to the needs of both Lua 5.3 and 5.4 users. According to the Lua 5.3 documentation for lua_gc (https://www.lua.org/manual/5.3/manual.html#lua_gc), the function signature is: Therefore, when we write:
This explains the compilation error in our earlier code; we failed to provide all required parameters for the function signature, even though the value of the third parameter is unused in this specific operation. |
This PR fixes Issue #72 by correcting the function call to
lua_gc, which was missing the required third parameter.Problem:
The
lua_gcfunction in Purr Data was called with only two parameters, causing a compilation error when building with Lua 5.3. According to the [official Lua 5.3 documentation](https://www.lua.org/manual/5.3/manual.html#lua_gc),lua_gcrequires three parameters:Solution:
lua_gcfunction call by adding the missing third parameter (data).0as the default value fordata, ensuring safe execution without unintended side effects.Testing:
Additional Context:
This issue likely arose due to an older Lua version where
lua_gcrequired only two parameters. Updating to Lua 5.3 necessitated this fix.Let me know if any further changes are needed! 🚀