Skip to content

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

Merged
tatsumoto-ren merged 1 commit intoAjatt-Tools:masterfrom
cnra:fix-type-shadowing
Sep 13, 2025
Merged

Fix shadowing of Lua’s built-in type() function by renaming parameter in create_job#144
tatsumoto-ren merged 1 commit intoAjatt-Tools:masterfrom
cnra:fix-type-shadowing

Conversation

@cnra
Copy link
Copy Markdown
Contributor

@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.

@tatsumoto-ren tatsumoto-ren merged commit 790688c into Ajatt-Tools:master Sep 13, 2025
@tatsumoto-ren
Copy link
Copy Markdown
Member

Thanks!

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.

2 participants