Skip to content

Instantly share code, notes, and snippets.

@legumbre
Created October 4, 2014 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save legumbre/67bb2583b400bcc08701 to your computer and use it in GitHub Desktop.
Save legumbre/67bb2583b400bcc08701 to your computer and use it in GitHub Desktop.
prototype lua tostring
prototype = require 'prototype'
person = prototype { default = prototype.assignment_copy, use_prototype_delegation = true }
person.__tostring = function (s) return "My name is " .. s.name end
cacho = person:clone()
cacho.name = "Cacho"
print(cacho)
pocha = person:clone()
pocha.name = "La Pocha"
print(pocha)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment