lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Long story short: The main selling points of Lua are very small memory footprint for a dynamically, interpreted language and being in the realm of classical non-JIT languages the fastest beast around including fast upstart times (where JITs generally suck)

If these things are among your top considerations for a project, Lua it is for you.

If not there are likely better options for that particular project, be it a compiled language, a natively JIT enabled or one of the several scripting languages with more "batteries included".

Metatables, _ENV, coroutines etc. are just relatively minuscule flavor details, for which you'll easily find a functional equivalent anywhere, maybe it's not so much your flavor but that just details.

On Fri, Apr 21, 2017 at 9:04 AM, Eike Decker <zet23t@googlemail.com> wrote:
Hello Lua Users,

I'm preparing for a talk at my company in which I want to focus on things that are exclusive about Lua (and which I keep missing in other programming languages). 

While metatables are are neat, the concept isn't foreign in other languages (albeit it's often not as complete nor as concise). 

Things that come to my mind which I have never/rarely/barely encountered in other languages is:

1) The debug API which enables me to inspect the stack variables and defining hook functions within my program. While this can somehow be done in other languages, I am not aware of any language where this is an intrinsic part of the language API itself; It's always a mere VM functionality that is "chiseled in stone". 
Also cool is the ability to set a hook function that gets executed only after a certain amount of instructions, which is great for programming contests where the most efficient solution is searched - at least this makes the comparison very fair.

2) Environment tables which allows faking/sandboxing the global registry for functions: This is not impossible to do in other languages, but it's usually not as simple and often not even possible at all within the language itself. 

3) Coroutines: True coroutines are available in some other languages and some languages offer extensions for this, but again, this isn't easy nor cheap to do - and often not possible as well.

This is the list I would go through and showing examples for each point and what it can be used for.

Do you have anything else that comes to your mind? I would also greatly appreciate input regarding other languages that implement these things above and how it's done there. I'm quite fluent in Java, C#, C, _javascript_ and knowledgeable in C++ and PHP. While reflection works in these languages (somehow), it's often requires very arcane knowledge to do similar things as mentioned 1-3. 

Please let me know your thoughts!

Cheers & have a nice Weekend,
Eike