From 2497fd9e7a0fae5ee4887890d7a312e0e08a93b8 Mon Sep 17 00:00:00 2001 From: Determinant Date: Mon, 22 Jun 2015 19:01:29 +0800 Subject: major change: use luarocks to manage project --- doc/nerv_class.md | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 doc/nerv_class.md (limited to 'doc/nerv_class.md') diff --git a/doc/nerv_class.md b/doc/nerv_class.md deleted file mode 100644 index 99f63e7..0000000 --- a/doc/nerv_class.md +++ /dev/null @@ -1,36 +0,0 @@ -#The Nerv OOP# -Part of the [Nerv](../README.md) toolkit. -##Methods## -* __metatable mt, metatable mpt = nerv.class(string tname, string parenttname)__ -This method is used to create a class by the name `tname`, which inherits `parenttname` in __Nerv__, then you create a new instance of this class by calling `obj=tname(...)`. The `tname.__init(...)` method(if defined) will be called in the constructing. The metatable of the class and its parent class will be returned. - -##Examples## -* This example implements a simple `nerv.Counter` class which is inherited by `nerv.BetterCounter`. - -``` -do - nerv.class("nerv.Counter") - function nerv.Counter:__init(c) - if (c) then - self.c = c - else - self.c = 0 - end - end -end -do - local mt, mpt = nerv.class("nerv.BetterCounter", "nerv.Counter") - function nerv.BetterCounter:__init(c, bc) - mpt.__init(self, c) - if (bc) then - self.bc = bc - else - self.bc = 0 - end - end -end -c1 = nerv.Counter(1) -print(c1.c) -bc1 = nerv.BetterCounter(1, 1) -print(bc1.c, bc1.bc) -``` \ No newline at end of file -- cgit v1.2.3