Skip to content
Control access to objects in pure Lua
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
README.md
proxy.lua

README.md

proxy.lua

Control access to Lua objects.

local proxy = require('proxy').new()

proxy:override('__index', function(t, k)
  print('indexing ', t, 'at', k)
  return t[k]
end)

-- calling proxy() wraps the given object and returns a proxy object
_G = proxy(_G)
print(_G._VERSION)

You can also override specific values:

proxy:override(loadstring, nil)
print(loadstring) --> nil
You can’t perform that action at this time.