I know this question is seven years old, but Lua 5.4
finally brings const
to the developers!
local a <const> = 42
a = 100500
Will produce an error:
lua: tmp.lua:2: attempt to assign to const variable 'a'
Docs: https://www.lua.org/manual/5.4/manual.html#3.3.7.