Metatable meme

>metatable meme
>ipairs({k = 'v'}) doesn't give you anything
>table.unpack instead of a splat operator

Why the fuck do people use this garbage

Because they think it is well supported, while in reality PUC RIO does what the fuck they want and LuaJIT is becoming incompatible and dying.

They also use it for inappropriate things like game scripting, while it was never made for this and it shows.

It's like a minimalist JS that's very easy to embed into other programs (at least compared to cluster fucks like Python and some/all JS engines).

>ipairs({k = 'v'}) doesn't give you anything
What should it do?

It's mostly clean, minimalist, and most important of all: no fucking hipsters.

It's used for scripting because there was no standard. Lua is/was the easiest to embed, with a very low footprint, and it kinda became the de facto standard because no one actually used one common language for this (companies usually created their own scripting language instead).

>What should it do?
It's name implies it should perform some variant of pairs, perhaps sorted pairs. Instead it treats the clusterfuck that is a table only like an array, completely ignoring the non-numerical keys. Why would you mash together maps and arrays if you're just going to do this shit?

>mostly clean
Explain the clusterfuck that is tables, the PRIMARY data structure of Lua.
>no fucking hipsters
Maybe cause no one wants to fucking use it

>companies usually created their own scripting language instead
I'm inclined to agree with them, given how well made Bethesdas and Projekt CD RED and some engine vendors custom languages are, but then again there is the mess that is doom scripting.

>greenspun's tenth rule
Why is lisp not a standard for embedded scripting?

Monkeys can't do anything properly, what did you expect?

>Why would you mash together maps and arrays if you're just going to do this shit?
Probably because real world applications need their specific performance characteristics after all. I think most practical Lua implementations treat a continous sequence of keys 1..N as a special case that has some chance of remaining special as long as you only manipulate the "array" via the dedicated functions.

I guess autistic minimalism can be a breath of fresh air after the cluster fuck of JS and even worse languages, but this just feels like OpenGL cramming its existing functionality full of new and confusing behaviors because they didn't want to change too many things at once.

Ruby memers out.

Because there is no modern and appropriate lisp dialect for embedded scripting.
Also, there is no non-cancerous, bytecode based, non-GNU, non-cancer API interpreter.

Define modern and define appropriate.

>define modern
released in 2016 or later
>define appropriate
lightweight and easy to embed
DUH!

Of what relevance is release date? Are you an Atom user?

>answering for somebody else
who am i kidding i do that all the time
>at least common lisp tier
>small standard library with a clear distinction between safe host functions and - optionally loaded - unsafe host functions, supporting a standardized VM sandbox
>standardizes - as in from the beginning - but overwritable/opt-out import mechanism
Probably a lot more, but it's too late right now.

>>ipairs({k = 'v'}) doesn't give you anything
ipairs is for integer keys (i.e. arrays), hence 'i'. pairs() is the iterator function you would use.
Learn to read the fucking documentation before you embarrass yourself.

There are loads of lovely embedded Schemes with utilitarian standard libraries that are exposed to the child code optionally one by one.

The reason few projects embed a lisp is that barely anyone understands lisp.

>Lua 5.0 uses a new
algorithm that detects whether tables are being used as arrays and auto-
matically stores the values associated to numeric indices in an actual array,
instead of adding them to the hash table.
>Performance
Seems like useless overhead to me.

So you're defending the choice of classifying arrays as a subset of unordered maps?

Avoiding hashing is avoiding overhead.

Have you considered that if arrays were their own construct, there would be no avoiding to begin with? The fastest code is no code.

>There are loads of lovely embedded Schemes with utilitarian standard libraries that are exposed to the child code optionally one by one.
There are exactly two which aren't utter crap, Chibi and Guile and they aren't an option for reasons I mentioned.

Have you considered that tables are to Lua almost as lists are to Lisp?

>detects whether tables are being used as arrays
Is this where it all breaks down if you _want_ to store nil as an array element?

Except lists are lists in lisp, not a forced combination of two unrelated data structures.

How could I forget about the fucking dumb as shit nil meme? Thanks.