1
0
mirror of https://github.com/fluencelabs/redis synced 2025-06-11 16:21:21 +00:00
Files
deps
hiredis
jemalloc
linenoise
lua
doc
etc
src
test
README
bisect.lua
cf.lua
echo.lua
env.lua
factorial.lua
fib.lua
fibfor.lua
globals.lua
hello.lua
life.lua
luac.lua
printf.lua
readonly.lua
sieve.lua
sort.lua
table.lua
trace-calls.lua
trace-globals.lua
xd.lua
COPYRIGHT
HISTORY
INSTALL
Makefile
README
Makefile
src
tests
utils
.gitignore
00-RELEASENOTES
BUGS
CONTRIBUTING
COPYING
INSTALL
MANIFESTO
Makefile
README
redis.conf
runtest
runtest-sentinel
sentinel.conf
redis/deps/lua/test/readonly.lua

13 lines
260 B
Lua
Raw Normal View History

-- 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'