Skip to content

Generated Lua program produce an error: attempt to assign to const variable #136

Description

@ligurio

About 14% of produced programs have an error attempt to assign to const variable.

for Name0 in pairs({}) do
  Name0 = 'Name'
end;

Reproduced with latest Lua versions (master, 5.5+).

$ lua -v
Lua 5.5.0  Copyright (C) 1994-2025 Lua.org, PUC-Rio
$ lua const.lua 
lua: const.lua:2: attempt to assign to const variable 'Name0'
$ luajit -v
LuaJIT 2.1.1748504477 -- Copyright (C) 2005-2025 Mike Pall. https://luajit.org/
$ ~/sources/cache/LuaJIT/src/luajit const.lua 
$ 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions