Advertisement
fatboychummy

Shared Value - Crappy pointers in Lua

Oct 17th, 2022
1,207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.21 KB | None | 0 0
  1. local function sharedValue(v)
  2.   return setmetatable({Value = v}, {
  3.     __unm = function(t)
  4.       return t.Value
  5.     end,
  6.     __call = function(t, v)
  7.       t.Value = v
  8.     end
  9.   })
  10. end
  11.  
  12. return sharedValue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement