This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
NewerOlder