GE Lua Documentation

Press F to search!

__newindex

Definition


-- @/lua/common/luaBinding.lua:112

function __luaBindNewindexStatic(t, k, v)
  local mt = getmetatable(t)
  local origsetters = rawget(mt, 2) -- 2 = setters
  local setFunc = rawget(origsetters, k)
  if setFunc ~= nil then
    setFunc(v)
    return
  end

  while true do
    mt = rawget(mt, 3) -- 3 = super
    if not mt then
      --log('E', '', string.format("property '%s.%s' is not found or not writable: %s", getmetatable(t).___type, k, debug.traceback()))
      return
    end
    local setters = rawget(mt, 2) -- 2 = setters
    if setters then
      local setFunc = rawget(setters, k)
      if type(setFunc) == 'function' then
        rawset(origsetters, k, setFunc)
        setFunc(v)
        return
      end
    end
  end
end

Callers

@/lua/common/libs/LuLPeg/lulpeg.lua
    end
    function byteset_mt.__newindex(s,i,v)
        s.v[i] = v
    end
    function pattmt:__newindex(k, v)
        proxycache[self][k] = v