fork download
  1. -- your code goes here
  2.  
  3. local my_class = {}
  4. my_class.__index = my_class
  5.  
  6. function is_my_class(obj)
  7. return getmetatable(obj) == my_class
  8. end
  9.  
  10. function my_class:new(x, y)
  11. return setmetatable({ x = x, y = y}, my_class)
  12. end
  13.  
  14. local x = my_class:new(10, 11)
  15.  
  16. print(is_my_class(x))
  17.  
Success #stdin #stdout 0.02s 2544KB
stdin
Standard input is empty
stdout
true