Lua

What is holding Lua back as a programming language.

Other urls found in this thread:

squirrel-lang.org/
en.wikipedia.org/wiki/Category:Lua-scripted_video_games
twitter.com/SFWRedditImages

It's shit overall. The only thing it has going for it is that it's easy to embed

Actual use of Lua is holding it back as a programming language.

Who the fuck uses it?

Video games. Nothing serious.

Lua solves no problems that other languages dont solve better
thats about all it has going for it.

This is the 3rd lua thread i've seen today. Those damn Brazilians must be shilling hard. Also pic related is why lua sucks.

Its obsolete for anything accept game scripting. A language like Julia blows Lua away in both speed and features.

Javascript was always a better language than Lua, and implementation like V8 and Spidermonkey run faster than Lua. Prototype OO is much better than using tables for OO.

The fact that it's a scripting language, not a programming language.

it's only used in games like ROBLOX and World of Warcraft

that's all it has going for it

Don't forget Garry's Mod, the game it's almost entirely lua, same for the addons.

Package management

Lua is as fast as C.

that's one of the problems Lua doesn't have. luarocks is pretty good

t. people who think video games are ideas

lua is being held back by:
-metatables, they're dumb, janky, and at the end of the day basically pointless
-global by default
-having to type the entire word 'function' for function definition and lambdas
-shitty looping constructs (numeric 'for', the weird 'in pairs' foreach)
-no support for LCO
-hashmaps, its only data structure (although it is interesting, it's not really ideal)
-no multithreading (which could work very nicely)
-dumb operators/comments (~=, --, and it doesn't have any excuse for either)
-arrays starting from 1 (i have never had a problem with this but it's still dumb)
-vararg functions are weird and the '...' is its own second-class data type
oh and it doesn't really have pointers/references of any kind, but you can throw something in a table and unpack it if you're ghetto

all of these are actually really easy to fix and you could probably make a really neat fork that does all of this, lua is a great language but it's not perfect

no it is not even remotely
luajit can be as fast as compiled languages in general given a trivial-enough problem, but 'lua' (especially the interpreter named after it) is nowhere near as fast as 'c' (given any popular compiler), and luajit is on /average/ around as fast as java, which is a large accomplishment
javascript is like lua but worse in every way, tho.

Roblox

you didnt mention having to explicitly declare variables as local. Ive never understood that, why not make all variables local by default and require explicit global declarations?

>Ive never understood that
You seem like you understand it.

I understand the concept, I dont understand the design choice, having to type local in front of almost all the variables really clutters the syntax, why would they not just make all variables implicitly local by default?

>arrays starting from 1 (i have never had a problem with this but it's still dumb)

I don't know lua, but arrays indexing from 0 makes sense in C only because arrays are pointer and the number is an offset from the base.

If you don't base your "array" on the memory hierarchy, you shouldn't be using offsets as indexing. Starting from 1 makes sense.

literally every videogame

no OOP so everyone has their own implementation using metatable fuckery.
also metatables in general

why cant there be a nice scheme thats as good, lean, and portable as lua (inb4 recommendation that only works with cygwin)

>no OOP so everyone has their own implementation using metatable fuckery.
>also metatables in general

There is a game scripting langauge called Squirrel that is small and fast like Lua but has real OO and C++-like syntax. If I were to need a game scripting langauge I would choose Squirrel over all the metatable bullshit of Lua
squirrel-lang.org/

>what is Corona

it fucks up several algorithms
for example (not that this is much of an "algorithm")
i % MAX
this works fine with 0 indexes but with 1s you have to add one to i and then subtract it from the end
that might make sense for mathematicians but in reality arrays starting from 0 just works out most of the time
plus, i think restricted (safe-ish) pointers could work well in lua
i actually wrote an essay on it but never handed it in

i did.
>global by default

there is actually a vague reason:
globals basically disable scoping, therefore, people who don't program don't need to learn scoping until they NEED to.
this is support by the "nil-by-default" concept, which, while it works, causes problems too. i don't really have any specific problems with it myself, though.

you don't need oop in a scripting language.
metatables are retarded, though.

It was designed for being executable json, nothing more. It isn't even fit for major game scripting, due to the non-incremental execution model.

>literally every videogame
>except for most AAA ones, aka the ones that matter
>no AAA engine supports it except for CryTech which is a burning trainwreck except for the renderer

This.

Lua is almost exactly the same thing as JS just with shit syntax, easier to embed, and with no community.

No, it isn't. Don't be daft. It's fast for a scripting language, and it has a competent jit compiler, but saying it's as fast as C is asinine. Not even C++ is as fast as C.

>Not even C++ is as fast as C.
You know that the important parts of C are just a subset of C++ and they share compiler backends at relevant platforms, user?

C++ doesn't even have restrict pointers.

>You know that the important parts of C are just a subset of C++ and they share compiler backends at relevant platforms, user?
No. You have it ass backwards. C++ is a superset of C that adds significant run time and compile time overhead, and has been shown in benchmarks to run slower and use more memory than C.

Sure, if you leave out all of the C++ features the compiler might spit out assembly comparable with C output, but at that point you're just writing C, and have proven the only way to get C performance is to write C.

>the important parts of C
This really shows how little understanding you have. Do you know how small C is? What are the "important parts" of C? What makes C so fast is it only throws a thin veil over the assembly being produced and provides syntactic niceties for control and data constructs.

It's also used in Payday 2's BLT modding kit

In the standard, whereas every notable compiler supports __restricts__.
It's a non-matter anyway, since C can't utilize it that great and you'd better fall back to assembly for far greater effects.
Source: The LuaJIT guy, who is obviously better than you.

>knowledge out of my ass
>muh portable assembler meme
>muh non-knowledge about no-cost abstractions
>muh C++ uses more memory meme
nice one, user
Meanwhile even the stock implementations of std::vector easily beat any poor reinventing-the-wheel C implementation of dynamic arrays.
And that's not even such an impressive example, considering that's just C programmers being retarded.

I've used it a lot lately and I'd like to hear complaints.
I don't like dynamic typing in general but as a dynamically typed language it's simplicity in tables makes it extremely good for any sort of scripty thing. I much prefer it over python for instance. What it lacks (in my environment) is libraries. I'm writing some control portions of an embedded system. It's not my normal duties but it ended up this way.

What I miss directly is a neat way to handle nil value cases. It's very basic on that front and since you have so many variables that might not be initialized they need more than the
local a = potentiallyNil or 1

I understand how the lack of clutter in featureset is an advantage but I'm missing something there.

The sandbox is great though. And it performs well. Especially compared to its competition (see:not C).

>metatables
Agree. They're a mess. I don't use them because they're really not that useful usually. Maybe if they weren't a mess I'd use them.
>global by default
Very odd choice. But I don't think it holds the language back that much realistically.
>typing function
Most of us type fun+completeKey. I do like how it makes functions more greppable compared to a lot of languages. It's not a big deal.
>shitty looping
Disagree strongly. The [exploded tuple] in func(table) construct is great.
Don't see how numeric for is an annoyance at all. They're very clean.
>hashmaps
Sure. It's fit for purpose though. And it's not like you can't make a list or any other structure yourself though.
>multithreading
Optimization in a scripting language is weird. I support the decision to have the language be more pure in its targeted objective.
>operators
It's perfectly fine. Why are you picking on such irrelevant things?
>arrays starting at 1
Lua doesn't have a lot of libraries. It's kinda pointless to adhere to the convention if it bothers you this much. You can start from 0.
>lack of references
Yep that one really bothers me.

Better alternatives exist. The only reason why Lua is commonplace is because of its use in WoW (where I'll admit that it was really elegantly used), which made it the default scripting language that Sup Forumstards learn. Hence why it is used in most games that expose a scripting language to the players.

Putting that aside, I'd rather use embedded scheme than lua.

nobody trusts a language created by monkeys.

>where I'll admit that it was really elegantly used
It isn't. WoW had multiple performance and security/cheating problems thanks to not thinking it through.

Also, see , don't make the mistake to think en.wikipedia.org/wiki/Category:Lua-scripted_video_games means Lua is cut-out for video games. Many just fell for the hype and some are said to have run into similar problems as Blizzard.

Coroutines a shit, for scripting games you want proper incremental execution (meaning a couple of bytecodes per update cycle) and proper latent function support.

>squirrel
That's interesting. Looking at the syntax, it almost appears as if it took cues from Lua and a C type language.

I don't know how this isn't the first reply.