Advertisement
StefanBashkir

Fake Vector3

Dec 22nd, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. local Vector3 = {
  2.     new = function(n1,n2,n3)
  3.         local p = {}
  4.         p.x, p.y, p.z = n1,n2,n3
  5.         setmetatable(p, {
  6.             __tostring = function()
  7.                 return p.x..","..p.y..","..p.z
  8.             end;
  9.             __index = function(self,func, val, val2, val3)
  10.                 if func == "SetX" then
  11.                     return self.new(val,self.y,self.z)
  12.                 elseif func == "new" then
  13.                     print(val1, val2, val3)
  14.                 end
  15.             end
  16.             }
  17.         )
  18.     return p
  19.     end;
  20. }
  21.  
  22. local firstv3 = Vector3.new(1,2,4)
  23. print( firstv3:SetX(20) )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement