Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Nov 20, 2020. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patholua.lua
More file actions
Latest commit
54 lines (43 loc) · 1.25 KB
/
Copy patholua.lua
File metadata and controls
54 lines (43 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
-- Objective Lua runtime
-- © 2009 David Given
-- This program is licensed under the MIT public license.
--
-- WARNING!
-- This is a TOY!
-- Do not use this program for anything useful!
--
-- This file provides the runtime support needed for Objective Lua programs
-- to work. There's nothing complex here; it's based on a vanilla table
-- munging class structure. (In fact, it's not right, and needs to be
-- rewritten to use a different object model; see
-- Object#doesNotRecogniseSelector: in test.olua.)
module("olua", package.seeall)
functiondeclareclass(classname, superclass)
localclass= {}
class._methods= {}
localsuperclassmethods=nil
ifsuperclassthen
superclassmethods=superclass._methods
setmetatable(class, {__index=superclass})
setmetatable(class._methods, {__index=superclass._methods})
end
class._methods.class=function(self)
returnclass
end
class.superclass=function(self)
returnsuperclass
end
class.superclassMethods=function(self)
returnsuperclassmethods
end
class.name=function(self)
returnclassname
end
returnclass
end
functiondefineclassmethod(class, methodname, body)
class[methodname] =body
end
functiondefinemethod(class, methodname, body)
class._methods[methodname] =body
end