Skip to content

Fix shadowing of Lua’s built-in type() function by renaming parameter in create_job #144

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cnra
Copy link

@cnra cnra commented Jun 22, 2025

This PR fixes a runtime error caused by shadowing Lua's built-in type() function.
In encoder.lua, the function create_job used type as a parameter name, which overrides Lua's native type() function within its scope.

Specifically, at line 712, the code:

if type(on_finish_fn) == 'function' then
    on_finish_fn()
end

throws an error:

attempt to call upvalue 'type' (a string value)

because type was redefined as a string parameter instead of being the built-in function.

This fix renames the type parameter to job_type to avoid this naming conflict, resolving the error and preserving the intended behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant