Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
-- This file:
--   http://angg.twu.net/LUA/lvalue.lua.html
--   http://angg.twu.net/LUA/lvalue.lua
--           (find-angg "LUA/lvalue.lua")
-- Author: Eduardo Ochs <eduardoochs@gmail.com>
-- (defun e () (interactive) (find-angg "LUA/lvalue.lua"))

LValue = Class {
  type = "LValue",
  new  = function (vname)
      local get0 = "function (_) return "..vname.." end"
      local set0 = "function (_,o) "..vname.." = o end"
      local expl = "get: "..get0.."\n".."set: "..set0
      return LValue {
        get = expr(get0),
        set = expr(set0),
        explanation = expl
      }
    end,
  __tostring = function (lv) return lv.explanation end,
  __index = {
  },
}

--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "lvalue.lua"

A   = {}
A.b = 42

  lv_b = LValue.new("A.b")
= lv_b
= lv_b:get()
  lv_b:set(200)
= lv_b:get()
= A.b

--]]



--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "lvalue.lua"

--]]




--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "lvalue.lua"

-- getmetatable(_G)  --> nil

_LV      = {}
_LV["b"] = LValue.new("A.b")
_GMT     = {}
setmetatable(_G, _GMT)
_GMT.__newindex = function (tbl, key, value)
    -- print("__newindex:", key, value)
    local lv = _LV[key]
    if lv then lv:set(value) else rawset(tbl, key, value) end
  end
_GMT.__index = function (tbl, key)
    -- print("__index:", key)
    local lv = _LV[key]
    if lv then return lv:get() else return nil end
  end

foo = 42
foo = 43
b = 99
= A.b
= b

-- (find-lua51manual "#2.8" "Metatables")
--]]