mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 11:12:29 +00:00
chore: initial commit
This commit is contained in:
commit
70b00c5c38
965 changed files with 264882 additions and 0 deletions
12
vendor/lua-5.1.3/test/readonly.lua
vendored
Normal file
12
vendor/lua-5.1.3/test/readonly.lua
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
-- 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'
|
||||
Loading…
Add table
Add a link
Reference in a new issue