NotAshley
|
  |
| Joined: 16 Jan 2014 |
| Total Posts: 14257 |
|
|
| 05 Oct 2015 04:59 PM |
I found lots of cool ways to make things happen with function environments, metatables, and unconventional Lua syntax, and decided to create what, to its users, will feel like a brand new language that works in ROBLOX Studio
here's a code snippit (the #code tag is for ROBLOX+)
#code class "Apple" { private { Name = "coolest apple ever"; }; public { GetName = function() return self.Name; end }; } class "Main" { private { Main = function() local happy = new "Apple"; RBX.print ( happy.GetName() ); -- "coolest apple ever" return true; end; }; }
I wrote this example on the spot so I might have missed a syntax error or two, but yes this is all legitimate code and is what works so far with the module I am creating :d |
|
|
| Report Abuse |
|
|
NotAshley
|
  |
| Joined: 16 Jan 2014 |
| Total Posts: 14257 |
|
|
| 05 Oct 2015 04:59 PM |
| also, if used in the form of a modulescript, all scripts will share classes, meaning each script can have its own class and be used from other scripts |
|
|
| Report Abuse |
|
|
|
| 05 Oct 2015 05:01 PM |
what do you call this
Now this looks like a job for me. So everybody, just follow me. Cause we need a little, controversy. Cause it feels so empty without me. |
|
|
| Report Abuse |
|
|
NotAshley
|
  |
| Joined: 16 Jan 2014 |
| Total Posts: 14257 |
|
|
| 05 Oct 2015 05:02 PM |
| @Del idk but I hope people use it |
|
|
| Report Abuse |
|
|
sparker22
|
  |
| Joined: 11 Mar 2010 |
| Total Posts: 846 |
|
|
| 05 Oct 2015 05:02 PM |
TheLuaWeaver did something similar on a project.
IIRC this is the module - http://www.roblox.com/Weaver-OO-item?id=221990373 |
|
|
| Report Abuse |
|
|
NotAshley
|
  |
| Joined: 16 Jan 2014 |
| Total Posts: 14257 |
|
|
| 05 Oct 2015 05:02 PM |
| @spark I will check that out brb |
|
|
| Report Abuse |
|
|
Everesty
|
  |
| Joined: 08 Oct 2009 |
| Total Posts: 6156 |
|
|
| 05 Oct 2015 05:04 PM |
| If you search around enough, you'll find this being done for a long, long time. Nobody really actively uses it, though. Nonetheless, it's still pretty fun to make, at least (imo) as some practice. |
|
|
| Report Abuse |
|
|
NotAshley
|
  |
| Joined: 16 Jan 2014 |
| Total Posts: 14257 |
|
|
| 05 Oct 2015 05:05 PM |
| @Ever the thing that makes this differ from other OOP modules I've seen on ROBLOX is the syntax, the presence of a Main function, and the classes being shared between scripts, and probably a lot more when I get down to finding what else is possible |
|
|
| Report Abuse |
|
|
|
| 05 Oct 2015 05:08 PM |
whats the point of it
i make u math.sqrt() |
|
|
| Report Abuse |
|
|
NotAshley
|
  |
| Joined: 16 Jan 2014 |
| Total Posts: 14257 |
|
|
| 05 Oct 2015 05:09 PM |
@Illegally 1) OOP functionality 2) structureeeeeee 3) transitioning from Lua to other languages 4) transitioning from other languages to Lua |
|
|
| Report Abuse |
|
|
|
| 05 Oct 2015 05:16 PM |
``` class "Apple" { private { Name = "coolest apple ever"; }; public { GetName = function() return self.Name; end }; } class "Main" { private { Main = function() local happy = new "Apple"; RBX.print ( happy.GetName() ); -- "coolest apple ever" return true; end; }; } ```
Why exactly?...
-SmallTickerOfTime |
|
|
| Report Abuse |
|
|
NotAshley
|
  |
| Joined: 16 Jan 2014 |
| Total Posts: 14257 |
|
|
| 05 Oct 2015 05:17 PM |
| @Ticker I explained in the reply above yours. is there something bad about it? :c |
|
|
| Report Abuse |
|
|
|
| 05 Oct 2015 05:23 PM |
You might as well make a JS parser..
-GiganticTickerOfTime |
|
|
| Report Abuse |
|
|
NotAshley
|
  |
| Joined: 16 Jan 2014 |
| Total Posts: 14257 |
|
|
| 05 Oct 2015 05:24 PM |
| then people would have to write it in ugly strings with no syntax highlighting, and the auto-typing features of ROBLOX studio wouldn't work |
|
|
| Report Abuse |
|
|
Atrulable
|
  |
| Joined: 19 Dec 2008 |
| Total Posts: 2543 |
|
|
| 05 Oct 2015 05:28 PM |
Great concept. Just the RbxLua, in my opinion, doesn't need it really. ModuleScripts which are different but can hold a similar use if used correctly are fine.
Still though a fun project, would like to see the outcome. |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 05 Oct 2015 05:31 PM |
| Looks fun, add Valkyrie integration as a library? :3 |
|
|
| Report Abuse |
|
|
NotAshley
|
  |
| Joined: 16 Jan 2014 |
| Total Posts: 14257 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 05 Oct 2015 05:34 PM |
Oh God HELP AHH the inefficiency hurts.
Good concept but it's been done before, so uhh yeah. |
|
|
| Report Abuse |
|
|
NotAshley
|
  |
| Joined: 16 Jan 2014 |
| Total Posts: 14257 |
|
|
| 05 Oct 2015 05:34 PM |
| @cnt could you link me to the project where it was done using this syntax? |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 05 Oct 2015 05:35 PM |
| We went open-source, so you can actually fork us and submit a pull request if you want to add it to the core as a Library. Otherwise, check if Valkyrie is injected in _G and use Valkyrie:AddLibrary(name, loaderFunction) |
|
|
| Report Abuse |
|
|
NotAshley
|
  |
| Joined: 16 Jan 2014 |
| Total Posts: 14257 |
|
|
| 05 Oct 2015 05:36 PM |
| @eLunate will do! I've never even used Valkyrie yet |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 05 Oct 2015 05:39 PM |
'@cnt could you link me to the project where it was done using this syntax?' Uh, well I never saw an actual script/whatever, I just saw threads about it being done.
Honestly you should forget the whole pseudo-braces because table creation is slow. It'd be better to use ( and ) and pass only a function. Or better yet some cool env. tricks and do-end |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 05 Oct 2015 05:39 PM |
https://github.com/ValkyrieRBXL/ValkyrieFramework
Take a look. |
|
|
| Report Abuse |
|
|
NotAshley
|
  |
| Joined: 16 Jan 2014 |
| Total Posts: 14257 |
|
|
| 05 Oct 2015 05:40 PM |
"Honestly you should forget the whole pseudo-braces because table creation is slow. It'd be better to use ( and ) and pass only a function. Or better yet some cool env. tricks and do-end"
it's not fake though, the created table is actually used by the module as a base for the class's contents |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 05 Oct 2015 05:42 PM |
| I meant fake implementation of braces using tables. As in, there are better ways but honestly your way (well, syntactically at least) is probably the most realistic. |
|
|
| Report Abuse |
|
|