diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-07-08 22:32:22 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2013-02-17 09:36:38 (GMT) |
commit | 2005f0914a8c39a0a2ba6eb51147c9a4955ca4b0 (patch) | |
tree | d7f1618aad7ad176912aa7112d5645604c144cfb /src/FbTk/LResourceHelper.lua | |
parent | 2d638f99c78b5abbde5c1506ef36fd6d4df6016c (diff) | |
download | fluxbox_pavel-2005f0914a8c39a0a2ba6eb51147c9a4955ca4b0.zip fluxbox_pavel-2005f0914a8c39a0a2ba6eb51147c9a4955ca4b0.tar.bz2 |
Lua: Make global variables read-only
This prevents the user from inadvertently overwriting e.g. the session table and then wondering
why it does not work. I'm still not sure about this approach, as it's not 100% secure (the script
can still use raw access to mess with it) and it adds some overhead to any operation referencing
a global variable.
Diffstat (limited to 'src/FbTk/LResourceHelper.lua')
-rw-r--r-- | src/FbTk/LResourceHelper.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/FbTk/LResourceHelper.lua b/src/FbTk/LResourceHelper.lua index 5171c43..0e61eb6 100644 --- a/src/FbTk/LResourceHelper.lua +++ b/src/FbTk/LResourceHelper.lua | |||
@@ -190,7 +190,7 @@ local function make_root(name) | |||
190 | __newindex = newindex, __index = index, | 190 | __newindex = newindex, __index = index, |
191 | _magic = cat_magic, _fullname = name, _state = 0 | 191 | _magic = cat_magic, _fullname = name, _state = 0 |
192 | }; | 192 | }; |
193 | getfenv()[name] = setmetatable({}, t); | 193 | return setmetatable({}, t); |
194 | end; | 194 | end; |
195 | 195 | ||
196 | return make_root, register_resource, dump; | 196 | return make_root, register_resource, dump; |