Sha256: 56f0bf6aed23d4d1944d7bc2fc4b8d3b0edecb2004469946672601b34d894a5a

Contents?: true

Size: 260 Bytes

Versions: 23

Compression:

Stored size: 260 Bytes

Contents

-- make global variables readonly

local f=function (t,i) error("cannot redefine global variable `"..i.."'",2) end
local g={}
local G=getfenv()
setmetatable(g,{__index=G,__newindex=f})
setfenv(1,g)

-- an example
rawset(g,"x",3)
x=2
y=1	-- cannot redefine `y'

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
dub-1.0.0 test/fixtures/app/vendor/lua/test/readonly.lua
dub-0.7.0 test/fixtures/app/vendor/lua/test/readonly.lua
Tamar-0.7.18 src/lua/test/readonly.lua
Tamar-0.7.17 src/lua/test/readonly.lua
Tamar-0.7.16 src/lua/test/readonly.lua
Tamar-0.7.14 src/lua/test/readonly.lua
Tamar-0.7.13 src/lua/test/readonly.lua
Tamar-0.7.12 src/lua/test/readonly.lua
Tamar-0.7.11 src/lua/test/readonly.lua
Tamar-0.7.10 src/lua/test/readonly.lua
Tamar-0.7.9 src/lua/test/readonly.lua
Tamar-0.7.8 src/lua/test/readonly.lua
Tamar-0.7.7 src/lua/test/readonly.lua
Tamar-0.7.6 src/lua/test/readonly.lua
dub-0.6.6 test/fixtures/app/vendor/lua/test/readonly.lua
dub-0.6.5 test/fixtures/app/vendor/lua/test/readonly.lua
dub-0.6.4 test/fixtures/app/vendor/lua/test/readonly.lua
dub-0.6.3 test/fixtures/app/vendor/lua/test/readonly.lua
dub-0.6.2 test/fixtures/app/vendor/lua/test/readonly.lua
dub-0.6.1 test/fixtures/app/vendor/lua/test/readonly.lua