Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
nam178875796yMan this is awesome, I remember I had something similar to parse mathematic expression,
I had a lexer to parse a string into words/gramma, and from there build the expression tree, etc.. -
Bubbles68266yIf I may, why use Lua? Is it something you prefer? Just curious, good job on what you’ve got so far😄
-
@Bubbles Favorite language
@SauceBoss That's exactly what it is! There's also a lot of c and c++ writing with lua -
Bubbles68266y@AlgoRythm I’m curious, why is it your favorite language? I’m guessing you use C or C++ a lot if that’s the case right?
-
@Bubbles Yes, I love c and c++
The Syntax of Lua is so wonderful. It reads like English so much. No silly brackets for scope. One-liners don't look awful, they look good:
while true do print end
if true then print end
It's written in clean C, so you can compile it anywhere pretty much. You can import dll and so files, provided they were specifically written for Lua, which means this language can pretty much do anything c can do with a little conversion work.
It's quick, handles large amounts of data well, and has a small footprint on the system.
It supports operator overloading (In a way, see metatables), OOP (again, metatables) and only has a few basic types (Pretty much number, string, function, and boolean)
Everything is just so clean and functional
The only blemish is that arrays start at 1. Everything else is great. -
@Bubbles It's great because you can really easily incorporate it into them without needing to install Lua on the client machine. It's the best embedded language.
And, as an unpopular opinion, arrays starting at 1 makes more sense when you aren't dealing with raw memory. Makes it easier to deal with strings and reduces the off-by-one errors. -
@Bubbles I've already done a big ole rant about the "1" thing but I wanna make a video about it. Explain why arrays start at 0 and why dynamic typed languages don't have arrays and why starting at 1 is non-standard but still correct and the advantages and disadvantages of it.
I think it's an interesting topic and it sucks when people just automatically see it as a bad thing.
Related Rants
I know it's not done yet but OOOOOH boy I'm proud already.
Writing a JSON parser in Lua and MMMM it can parse arrays! It converts to valid Lua types, respects the different quotation marks, works with nested objects, and even is fault-tolerant to a degree (ignoring most invalid syntax)
Here's the JSON array I wrote to test, the call to my function, and another call to another function I wrote to pretty print the result. You can see the types are correctly parsed, and the indentation shows the nested structure! (You can see the auto-key re-start at 1)
Very proud. Just gotta make it work for key/value objects (curly bracket bois) and I'm golden! (Easier said than done. Also it's 3am so fuck, dude)
random
proud
lua
json