object-oriented programming in lua
I know Lua doesn't provide objects/classes/inheritance by default, but its (awesome, brilliant, genius) metatable mechanism makes it possible to implement an OOP framework.
Does the engine test's Lua code already use such a scheme and/or provide a way to do it? If not, would other developers here be interested in a simple OOP library? I originally wrote it for use in a WoW addon, but it's generic Lua 5.1 code, so it should be easy enough to drop into NS2.
It just provides the basics: a simple way to define classes and extend them, separate inheritance for classes and their objects, subclassof/instanceof tests, and super-calls for method overrides.
Does the engine test's Lua code already use such a scheme and/or provide a way to do it? If not, would other developers here be interested in a simple OOP library? I originally wrote it for use in a WoW addon, but it's generic Lua 5.1 code, so it should be easy enough to drop into NS2.
It just provides the basics: a simple way to define classes and extend them, separate inheritance for classes and their objects, subclassof/instanceof tests, and super-calls for method overrides.
Comments
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->class 'Player' (Actor)<!--c2--></div><!--ec2-->
where Actor is the class extended by Player.
and class functions...
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->function Player:OnInit()
-- some code
end<!--c2--></div><!--ec2-->
buuut, i would be interested in looking at your library for my own tinkering..