LuaLua - OOP Programming Language for CC. NEW - Anonymous Function Syntax
#21
Posted 16 October 2013 - 07:28 PM
#22
Posted 18 October 2013 - 02:27 PM
#23
Posted 19 October 2013 - 06:45 PM
#24
Posted 20 October 2013 - 08:19 AM
Imque, on 19 October 2013 - 06:45 PM, said:
=) Thanks!
Anyway
I'm working on changing the syntax for methods a bit. It'll break old LuaLua programs but I think it's a little nicer.
-- instead of this
@[@[MyClass new] init]
@{globalCall}
-- it will be this
||MyClass new| init|
|@ globalCall|
Basically just replacing the weird @bracket system with vertical bars. Should work fine.
#25
Posted 20 October 2013 - 08:25 AM
ElvishJerricco, on 20 October 2013 - 08:19 AM, said:
-- instead of this
@[@[MyClass new] init]
@{globalCall}
-- it will be this
||MyClass new| init|
|@ globalCall|
Basically just replacing the weird @bracket system with vertical bars. Should work fine.
Also, just write a parser to support old versions by converting them into the new version. Perhaps the easiest solution is to have a header, if the file header is missing, parse it.
#26
Posted 20 October 2013 - 08:43 AM
theoriginalbit, on 20 October 2013 - 08:25 AM, said:
That's not a bad idea. And I still think it's Obj-C-like. Just uses a different ascii character =P
EDIT: Oh I should also note that declaring methods will be a little different.
-- instead of this function @(methodName:param) end -- it will be this function (methodName:param) endBasically just removing the unnecessary @ in front of the parentheses.
#27
Posted 20 October 2013 - 09:03 AM
#28
Posted 07 November 2013 - 12:40 PM
As a name change, may I suggest Objective-Lua? Since it is so heavily inspired on Objective-C.
#29
Posted 07 November 2013 - 01:44 PM
Wobbo, on 07 November 2013 - 12:40 PM, said:
As a name change, may I suggest Objective-Lua? Since it is so heavily inspired on Objective-C.
Thought about that. All in all, LuaLua isn't meant to be Object Oriented Lua. It's supposed to be an extension of it, hence a name that appears to just extend Lua.
#30
Posted 09 January 2014 - 12:24 PM
#31
Posted 16 January 2014 - 10:35 PM
robhol, on 09 January 2014 - 12:24 PM, said:
You don't have to use the ObjC syntax. Conventional lua syntax still works.
@class A:LuaObject
function myInstanceMethod()
print("Works like a charm")
end
end
local obj = A.new().init()
obj.myInstanceMethod()
Any function that doesn't take parameters is under the same name as it would normally be so new and init work fine, and there's no other functions built in except the subclass method which has no reason to be called manually. So if you don't want to use the new syntax you don't have to (unless your working with someone else's code who does use it). And even when there are parameters you can still access the method in vanilla Lua syntax.
NewClass = SuperClass["subclassWithClassInstantiator:andObjectInstantiator:"](function(self, super) -- static closure; same as body of the optional @static block end, function(self, super) -- instance closure; same as body of class block end)
This example also demonstrates creating classes without the LuaLua syntax.
Anyways three fourths of the work in LuaLua is compiler work, while the other fourth is runtime work. So if you're willing to redo almost all the work I've done for the sake of using the same runtime with your own syntax, go ahead.
And finally, objective c syntax is really nice. I'm curious why you don't like it. It's very descriptive of the method parameters and closing things in brackets this way looks a lot better to me.
Edited by ElvishJerricco, 16 January 2014 - 10:38 PM.
#32
Posted 28 February 2014 - 07:44 PM
#33
Posted 04 May 2014 - 09:38 AM
#34
Posted 25 May 2014 - 03:35 PM
As someone who knows Objective-C, this looks rather nice!
Gonna have to try it out!!
#35
Posted 04 June 2014 - 04:33 AM
blipman17, on 04 May 2014 - 09:38 AM, said:
I apologize for the incredibly late response. I've taken quite an absence from minecraft in general lately... Anyway what isn't clear about objects? I can try to make it more clear in the post.
#37
Posted 07 October 2014 - 12:42 AM
somethingThatTakesAFunction(\(p1, p2, ...) print(...) end)
#38
Posted 04 November 2014 - 05:41 AM
#39
Posted 02 January 2015 - 12:51 PM
#40
Posted 03 January 2015 - 10:02 PM
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











