Skip to content

Instantly share code, notes, and snippets.

View FlightBlaze's full-sized avatar
💭
%display_status%

Blaze FlightBlaze

💭
%display_status%
  • Russia
View GitHub Profile
@paulmoore
paulmoore / Animal.lua
Created December 4, 2011 07:06
A simple Class implementation in Lua for Object-Oriented Programming.
--- Animal.lua
--
-- A simple example of a base class usng the classes library.
--
-- @author PaulMoore
--
-- Copyright (C) 2011 by Strange Ideas Software
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
@paulcuth
paulcuth / instanceof.lua
Last active August 12, 2021 12:40
Implementation of instanceof in Lua
function instanceOf (subject, super)
super = tostring(super)
local mt = getmetatable(subject)
while true do
if mt == nil then return false end
if tostring(mt) == super then return true end
mt = getmetatable(mt)