Rendered at 13:01:54 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
tylerneylon 1 days ago [-]
It's not a coincidence that Lua's good at representing data -- the language started life as a data-specification syntax called Simple Object Language. Or SOL (sun), which evolved into Lua (moon). If you've used BibTeX, then SOL will look familiar -- also not a coincidence! (BibTeX was first.)
Lua is one of my favourite languages for many reasons. One of them being that I can use it all the time without actually writing a single line of Lua directly. My main use of it is through Fennel which is a lisp that compiles to Lua. In effect it's a better syntax (you can pry my parens from my cold dead hands) for Lua and it works with LuaJIT as well which is how I can use it in Neovim.
So every time I want to embed Lua in a project I bring in the Fennel compiler as well which is a single Lua file and end up with a very nice embedded lisp running on top of LuaJIT. There's also Janet which has the same spirit of being small and easily embeddable and even has the same creator as Fennel but I haven't played around with it as much.
gilber 1 days ago [-]
Lua as a whole is incredibly underrated, especially given things like LuaJIT - I don't understand why it felt out of popularity with most people. Maybe related to Roblox.
MomsAVoxell 1 days ago [-]
I think what happens with Lua is that, when someone decides to use it for a purpose, it ends up embedded and thus the ‘secret sauce’ for the app.
Which is to say, Lua is used practically everywhere.
I recently added Lua bindings to the BlenderUI library, and it was just so easy and fun - and immediately made nice UI development so productive. Coding up a BlenderUI with a Lua REPL is a very rewarding thing to do indeed.. so much so that I added Lua bindings to CUI, also!
_rousbound 23 hours ago [-]
Do you have a repo for these Lua bindings that you mentioned? (BlenderUI and CUI)
In BlenderUI repo, it mentions Lua bindings, but there aren't any docs about it.
In CUI repo, I didn't find any reference for Lua bindings.
Merged, a bit behind because of massive leaps in Blender UI progress this week, but if you're a Lua person keep an eye on things because I will bring the Lua bindings forward over the weekend to catch up with this weeks mad Blender UI progress.
Check the examples/lua directory, lots of examples and code, see also bindings/lua/README.md, etc.
I've already done a few small apps with this, and use the REPL for prototyping pretty successfully now .. but Blender UI has had some stonkin' pushes forward in the past week, I have to catch up a bit ..
CUI:
My PR hasn't been accepted, but you can nevertheless access it here:
.. I have to fight with the bot protecting upstreams' intake process a bit, its a little frustrating but I'm on it - because CUI is really pretty slick, to be honest.
I'll be working on pushing both forward - if you have suggestions/contributions also, I'm all ears ..
snthpy 8 hours ago [-]
I've also wondered why it's not used more by LLMs instead of python because it has much better startup times. My guess is those are not that significant relative to the remote model latency and amount of training data. I spent a bit of time looking into this and in the end decided that QuickJS was a better fit for my purposes of deterministic harness sidecar given ubiquity of JS code, eg cf Pi harness codemode.
jeffreyrogers 1 days ago [-]
It doesn't have a good standard library since it was designed to be embedded in C/C++ programs for scripting rather than being a standalone scripting language and the package management ecosystem never fully took off.
aa-jv 1 days ago [-]
Thats a feature, not a bug.
oblio 1 days ago [-]
Only if you build small things with it.
dididjejdjshd 1 days ago [-]
building small things is also arguably a feature rather than a bug. In so far as hard complex problems can be solved with small solutions with enough insight into the problem
oblio 22 hours ago [-]
Yes, as proven by oh-wait, no actual application of consequence on this planet.
Even ls has 60 flags.
aa-jv 23 hours ago [-]
No, its also true if you build big, important things, too.
oblio 22 hours ago [-]
True, that's why there are so many large Lua applications out there (I'm talking about the actual application, not the scripting layer).
kzrdude 1 days ago [-]
The number of forks of Lua is one sign that it's a very practical and useful technology. LuaJIT is essentially a half-compatible fork, and still on its own path to maybe become a full fledged fork.
edfsadfer 1 days ago [-]
I myself have gone almost all-in on Lua Lapis (running in OpenResty) and Lua Fullmoon (running in RedBean) for anything server related.
sirtaj 19 hours ago [-]
I've picked it up over the past few years, and it feels like the base lua vs luajit vs openresty split isn't helping. The third party libraries are already sparse and this just ends up splitting the community further. While it's like this, we're likely to always see it tacked on to some other app than say, an alternative to node or python.
(But it really does excel at the tacked-on job.)
altilunium 1 days ago [-]
when i was still involved in wikipedia template and module development, i was quite surprised that it mainly used lua.
kzrdude 1 days ago [-]
Lua is made to be embeddable in a safe and relatively minimal way. That's why it shows up in a lot of places. Want to run 100 independent Lua "VMs" in your process? Not a problem, it's safe to do so by default.
flufluflufluffy 1 days ago [-]
I always try to learn some Lua every 6 months or so and just get annoyed. I don’t doubt its usefulness, I just personally can’t bring myself to like it. 1-based indexing, no actual array/list type, depending on the version you might not even have bitwise operators. gotta call into a goddang library to AND 2 numbers together. like what the heck man
strenholme 23 hours ago [-]
1-based indexing: There’s nothing stopping you from making a table with a 0 key, e.g.
foo = {}
foo[0] = "Zero index in Lua!"
No actual array:
1) Lua has optimizations when a table only has numeric keys
2) This keeps Lua small. AWK, another tiny language, has the same behavior.
No bitwise operators:
Lua 5.2 and higher have bitwise operations,[1] and pretty much every modern Lua 5.1 fork (LuaJIT, the version of Lua Wikipedia uses for scripting, luau, my personal “lunacy” fork of Lua 5.1, etc.) has added bitwise operations.
The only case where a real-world Lua implementation doesn’t have bitwise operations is Adobe Lightroom Classic,[2] and even there is is possible to implement them with a polyfill.
[2] Alpine Linux has a lua5.1-bitop package which adds bit ops to their port of Lua 5.1
fullstop 22 hours ago [-]
I was unable to find a source, but I seem to recall a group handing out Lua rulers at a conference, and the first mark on the ruler was labeled 1cm.
The other bit was "Why do Lua indexes start at one? The FIRST reason is..."
The 1-based indexing, in my usage, has never been a problem. A lot of people run into this, and I feel that it is because they are trying to make something using only Lua. In fact, I would suggest that if you're trying to use Lua with a shebang that you might not like the language very much.
Where it truly shines is when it is embedded into another runtime. Find something that you already have and extend it so that functionality can be added through Lua scripts. You might even be surprised at how little you actually use indexing.
oblio 1 days ago [-]
Most of the stuff you mention is low level stuff. Lua is supposed to be a high level language.
I would argue that if you don't need to do manual memory management 1 based indexing should be default and all other language are doing things badly on this front.
krapp 16 hours ago [-]
The only time I've found 1 based indexing to be a problem is when I forget whether I'm iterating a C array or Lua table, but even then the fix is obvious. It's annoying but, I mean, people literally break into apopleptic rage over Javascript and it's one of if not the most widely used programming languages in existence.
And the current version of LuaJIT includes bitwise operators.
fithisux 1 days ago [-]
It hasn't. Luau comes with two runtimes. Lua distros are many.
lenkite 1 days ago [-]
[dead]
rdtsc 1 days ago [-]
Most developers don’t care about Roblox. Lua is cute but awkward.
Let’s see, no native json support. This day and age it should be built in. No array support: is {} an empty json object or empty json array? Just add the dang arrays already.
LuaJIT is very awesome! Amazingly fast. Does it support the latest Lua? Nope it doesn’t. Lua is at 5.5 or something, LuaJIT at 5.2 maybe.
Default global vars? Nope. More awkward than cute. Maybe introduce some profile / pragma to invert that. Everything should be local by default not global.
Speaking of Roblox, they liked Lua so much they forked it and created a new language altogether! Luau which is only fully compatible with 5.1
I mean it’s still a nice language for a configuration format but otherwise I think that summarizes why people might not be reaching for it as much, in other cases.
strenholme 1 days ago [-]
Wanting things like native JSON support goes against the Lua spirit. Something like that belongs in a library, and lo and behold, there are several:
Lua supports arrays; it has optimizations when all of a table’s keys are integers. Keep in mind that AWK is the same way: There’s no numeric array in AWK per se either, just AWK’s version of a “table”, but it works just fine when all of the keys are integers.
Keep in mind that I have a fork of Lua which is 116,224 bytes in size (security hardened Lua 5.1 with `lfs` support); Lua is tiny and that’s why it does not have a built in JSON library nor will it wash the dishes for you.
Versions of Lua after Lua 5.1 introduced changes which broke backward compatibility. Lua 5.1 is smaller than newer versions of Lua, runs great, and is incredibly fast. I see Lua 5.5 as a different language than Lua 5.1, even though one can make a polyglot program which can run in both. Lua 5.1 is also the point from which a bunch of offshoots were made: luau (Roblox Lua), LuaJIT, etc.
rdtsc 22 hours ago [-]
> Wanting things like native JSON support goes against the Lua spirit. Something like that belongs in a library, and lo and behold, there are several:
I guess my point is that why it's not picked as large of a support. I can see that being a good reason for Lua in 2006 when JSON was still not as popular but for better or worser, it's taken over so having built in JSON support would help, especially for a language geared for configuration and data representation.
> Keep in mind that I have a fork of Lua which is 116,224 bytes in size (security hardened Lua 5.1 with `lfs` support); Lua is tiny and that’s why it does not have a built in JSON library nor will it wash the dishes for you.
Agree, that's where it really shines, it's small and embeddable.
> Lua 5.1 is also the point from which a bunch of offshoots were made: luau (Roblox Lua), LuaJIT, etc.
But you see how the official site doesn't seem to issue bug fixes for anything lower than 5.4 yet everyone says 5.1 is the version to stick with. And there is luau and LuaJIT as well, that I think explains a bit why people are embracing it as eagerly any longer.
strenholme 21 hours ago [-]
There is a fork of Lua which is “Lua with a bunch of other stuff” called Pluto. It’s a superset of Lua 5.5, and it includes a bunch of other things such as JSON support.
The reason I like Lua is because I use it like a tiny Perl, but, unlike Perl, I already include the entire language with my open source project (it’s embedded in another program I wrote) so my Lua scripts in said project will run on any POSIX compliant system: The Lua fork I use and include also compiles as a standalone scripting language.
disperso 23 hours ago [-]
LuaJIT borrowed from 5.2 and 5.3 (PUC-Rio's Lua) what it could without breaking compatibility, as I understand it. LuaJIT 3.0 adds some feature of its own.
All the Lua 5.x versions that I have seen have small compatibility issues, and that's why many projects stick with what it's compatible with 5.1 only.
C++ doesn't have any "native json support" either, and that's fine. I don't think JSON is that critical. You can use a library for the kind of serialization that you want. Neovim uses JSON and Lua extensively, and it just uses a C library inside.
It's true that `{}` doubles down as an empty array or an empty map. It is not a problem that often, IME. You also can't signal that a certain key in a map is `nil`, but you can use a sentinel for it. You can do the same to disambiguate between these two.
Different features hit differently to different people. I agree that global by default seems so wrong, but I just go used to it, and I don't care anymore. To me, the main deal is not that Lua doesn't have this features by default, is more that, when I want them, there is no generally agreed library/framework that can plug all the features in a unified, coherent way. Penlight should be that, but I don't like it that much.
This is something that personally hits me the most, because I'm used to Qt. With Qt, I have tons and tons of functionality and a well established community and practices.
rdtsc 22 hours ago [-]
> All the Lua 5.x versions that I have seen have small compatibility issues, and that's why many projects stick with what it's compatible with 5.1 only.
But you see how "why isn't Lua more popular" is answered with that? Do I start with 5.5? 5.3 and below seems is EoL already per the official site, they only have 5.4 bug fixes. It's a bit like C++ I guess, use only a small subset of features perhaps?
> C++ doesn't have any "native json support" either, and that's fine.
Unlike C++ Lua posits itself as an easy data representation and configuration language but it doesn't have a built-in way to load one of the most popular serialization formats out there these day.
> Different features hit differently to different people.
Definitely, I am just explaining why it doesn't appeal to me and the reason I heard other people didn't start or continue using it.
disperso 20 hours ago [-]
Oh, I definitely agree that the issues of version compatibility are a problem for wider adoption. I have written a few small Lua projects, and I always struggle to decide which versions to support.
If it had a few changes and perhaps some optional additions (while keeping a "classic" or "standalone" version), it would probably be more popular.
> Unlike C++ Lua posits itself as an easy data representation and configuration language but it doesn't have a built-in way to load one of the most popular serialization formats out there these day.
But that's the thing: if you want to represent data or configure something, wouldn't you prefer to do it in Lua? Seems the history of the language was using Lua syntax for the data representation, which is a bit more convenient than JSON for a few schemas. JSON is useful for interoperability, but it's far from my favorite for making a configuration file. The next project I'm working on is a small Lua script that will let the user configure itself via Lua, because that's more convenient than a static config format.
strenholme 23 hours ago [-]
Pluto is a fork of Lua 5.5 which is “Lua with a bunch of standard libraries” and other features like more mainstream classes. Yes, Pluto does have built-in JSON support.
luajit and luau supporting 5.1 only is a feature: it freeze language so no more backward compatibility breaks
Lua has many quirks (global by default etc.) but with a language server like https://luals.github.io/, you can detect most of them easily plus optional type annotations.
strenholme 23 hours ago [-]
Also, it’s possible to force global variables to be explicitly declared.
function declare(name)
rawset(_G,name,false)
end
function exists(name)
if rawget(_G,name) ~= nil then
return true
else return false end
end
setmetatable(_G, {
__newindex = function(self,x) error("Undeclared global " .. x) end,
__index = function(self,x) error("Undeclared global " .. x) end
})
And now
declare("foo")
foo = 1
-- Create name if it hasn’t
-- been declared yet
if not exists("name") then
declare("name")
name = 1
end
That is neat how that's possible to do! It would be nice if it would just do local by default as well. Basically swap the defaults: everything is local and only what's explicitly global is global? I realize it's not an easy thing to change at this point in the game. Maybe some compile pragma or another extension could help? But it should be a new default in a modern language.
strenholme 21 hours ago [-]
The reason I put up with things like global by default, no “continue”, “--” instead of “#” for comments, and so on is because Lua is widely implemented, to the point it’s an informal standard for embedded scripting. There’s PUC Lua (the original), LuaJIT, Lua in Rust, Lua in Go, Lua in C#, Lua in Javascript, Lua that compiles to native code, and so on. All of these variants have agreed on having Lua, flaws and all.
I would love to see a POSIX standard for Lua (probably based on Lua 5.1); it’s widely enough deployed that a standard for it would make sense. Right now the standard is either PUC Lua 5.1 or whatever the latest release of PUA Lua is at a given time.
I prefer Lua over Perl/Python/Ruby because I know I can get a Lua runtime going in whatever environment I’m in—e.g. when writing my Lua book, I used my personal fork of Lua 5.1, but the person I was writing the book with was using Moonsharp (Lua in C#) since they were a C# developer. We could easily share code with each other.
fwip 21 hours ago [-]
Rust doesn't have native or stdlib JSON support either, and it is relatively modern (and quite popular).
gonzus 1 days ago [-]
In my experience, tying your data format to a programming language is a mistake you most likely will pay for later. For example, when you need access to that data from a different programming language.
code_biologist 1 days ago [-]
I agree, but Lua is the singular language that might just maaaybe be the exception to that sometimes.
If you need to access the data from a different language, you just load Lua in the other language.
aa-jv 1 days ago [-]
Many non-Lua folks don't understand this point: once you've got it in Lua you can put it in anything, anywhere.
strenholme 23 hours ago [-]
One nice thing about Lua is that there are Lua implementations in Rust, C, C#, Go, Javascript, Kotlin, and there’s even a compiler which converts Lua scripts in to native machine code.
tcfhgj 1 days ago [-]
While I am even doing that in a project if mine, I'd rather not load Lua and instead just run `serde_json::from_str()` or similar.
chii 1 days ago [-]
using json is an option (which is mentioned in the article). But lua gives you some features that json cannot match - it's powerful, may be too powerful tbh.
TheCycoONE 1 days ago [-]
For better or worse CorsixTH makes extensive use of these techniques, as the config format [1], the translation format [2], and even the format for the update check [3]
The 3Delight|NSI offline 3D renderer has supported Lua as scene description (essentially data) since about 15 years.
It was their answer to the old VFX industry default, RIB (or custom scene description) files (i.e. data) manipulated with "filters" or inline-expanded Python inside the "pipeline".
Didn't get traction but it was the right idea and they never discontinued support for it.
If you watch movies/series containing VFX you have seen CGI rendered with 3Delight. But most of it will have been intermediate .nsi files, not .lua.
Mikhail_Edoshin 1 days ago [-]
I'd say a tool-command format is a distinct and very good syntax for arbitrary data representation. The input consists of lines; each line starts with a command name, followed by optional arguments. There is some continuation syntax to wrap long arguments. The order of lines matters because each line is executed with its argument by some handler; the handler may modify the execution context. Aside from the command name there is no syntax other than whitespace. And since it quietly accumulates the context it gets very compact too.
computerfriend 1 days ago [-]
Unrelated to the content: the ad at the bottom is from a very delightful ad network https://john.citrons.xyz/.
binary132 1 days ago [-]
It’s also pretty nice that a verb plus a table is implicitly a function call. This means you can easily do things that seem to be types:
m = Menagerie {
Dog { tail, ears, snout=long },
Cat { you, get, the=idea },
table.unpack(ark),
}
sudahtigabulan 1 days ago [-]
This syntax is inherited from one of Lua's predecessors, Sol, for compatibility, and in Sol, it actually means types!
There are a couple of snippets here that refer to it (search for @track):
C types as well (with LuaJIT.). Building metaclasses around SDL objects and adding a tostring function to they can all be printed, for instance. It's so much easier to build a C API in Lua than it is to build a Lua API in C.
binary132 9 hours ago [-]
You don’t need anything special to do that, you can just export Lua functions that return userdata
1vuio0pswjnm7 9 hours ago [-]
"anyway, download this file. if you want to consume massive amounts of memory and possibly crash your computer, run it in cpython."
No thanks
"if you want to see "hello, world" printed 5 million times, run it in lua. lua's parser is designed to handle massive files with stride, which is fairly unique and quite necessary if lua is to be used for this purpose."
OK
chuckadams 19 hours ago [-]
It's a fine extension language, but I'll take a very hard pass on Turing-complete config formats, thanks.
The article indirectly nods to that history by linking here: https://www.lua.org/history.html#:~:text=All%20this%20config...
So every time I want to embed Lua in a project I bring in the Fennel compiler as well which is a single Lua file and end up with a very nice embedded lisp running on top of LuaJIT. There's also Janet which has the same spirit of being small and easily embeddable and even has the same creator as Fennel but I haven't played around with it as much.
Which is to say, Lua is used practically everywhere.
I recently added Lua bindings to the BlenderUI library, and it was just so easy and fun - and immediately made nice UI development so productive. Coding up a BlenderUI with a Lua REPL is a very rewarding thing to do indeed.. so much so that I added Lua bindings to CUI, also!
In BlenderUI repo, it mentions Lua bindings, but there aren't any docs about it.
In CUI repo, I didn't find any reference for Lua bindings.
Thanks in advance!
https://github.com/ppmpreetham/BUI.git
Merged, a bit behind because of massive leaps in Blender UI progress this week, but if you're a Lua person keep an eye on things because I will bring the Lua bindings forward over the weekend to catch up with this weeks mad Blender UI progress.
Check the examples/lua directory, lots of examples and code, see also bindings/lua/README.md, etc.
I've already done a few small apps with this, and use the REPL for prototyping pretty successfully now .. but Blender UI has had some stonkin' pushes forward in the past week, I have to catch up a bit ..
CUI:
My PR hasn't been accepted, but you can nevertheless access it here:
https://github.com/yappologistic/CUI/pull/22
.. I have to fight with the bot protecting upstreams' intake process a bit, its a little frustrating but I'm on it - because CUI is really pretty slick, to be honest.
I'll be working on pushing both forward - if you have suggestions/contributions also, I'm all ears ..
Even ls has 60 flags.
(But it really does excel at the tacked-on job.)
1) Lua has optimizations when a table only has numeric keys
2) This keeps Lua small. AWK, another tiny language, has the same behavior.
No bitwise operators:
Lua 5.2 and higher have bitwise operations,[1] and pretty much every modern Lua 5.1 fork (LuaJIT, the version of Lua Wikipedia uses for scripting, luau, my personal “lunacy” fork of Lua 5.1, etc.) has added bitwise operations.
The only case where a real-world Lua implementation doesn’t have bitwise operations is Adobe Lightroom Classic,[2] and even there is is possible to implement them with a polyfill.
[1] https://lua.org/manual/5.2/manual.html#6.7
[2] Alpine Linux has a lua5.1-bitop package which adds bit ops to their port of Lua 5.1
The other bit was "Why do Lua indexes start at one? The FIRST reason is..."
The 1-based indexing, in my usage, has never been a problem. A lot of people run into this, and I feel that it is because they are trying to make something using only Lua. In fact, I would suggest that if you're trying to use Lua with a shebang that you might not like the language very much.
Where it truly shines is when it is embedded into another runtime. Find something that you already have and extend it so that functionality can be added through Lua scripts. You might even be surprised at how little you actually use indexing.
I would argue that if you don't need to do manual memory management 1 based indexing should be default and all other language are doing things badly on this front.
And the current version of LuaJIT includes bitwise operators.
Let’s see, no native json support. This day and age it should be built in. No array support: is {} an empty json object or empty json array? Just add the dang arrays already.
LuaJIT is very awesome! Amazingly fast. Does it support the latest Lua? Nope it doesn’t. Lua is at 5.5 or something, LuaJIT at 5.2 maybe.
Default global vars? Nope. More awkward than cute. Maybe introduce some profile / pragma to invert that. Everything should be local by default not global.
Speaking of Roblox, they liked Lua so much they forked it and created a new language altogether! Luau which is only fully compatible with 5.1
I mean it’s still a nice language for a configuration format but otherwise I think that summarizes why people might not be reaching for it as much, in other cases.
https://luarocks.org/modules/luarocks/json4lua - https://luarocks.org/modules/winterstream/wjson - https://luarocks.org/modules/xpol/rapidjson - etc.
Lua supports arrays; it has optimizations when all of a table’s keys are integers. Keep in mind that AWK is the same way: There’s no numeric array in AWK per se either, just AWK’s version of a “table”, but it works just fine when all of the keys are integers.
Keep in mind that I have a fork of Lua which is 116,224 bytes in size (security hardened Lua 5.1 with `lfs` support); Lua is tiny and that’s why it does not have a built in JSON library nor will it wash the dishes for you.
Versions of Lua after Lua 5.1 introduced changes which broke backward compatibility. Lua 5.1 is smaller than newer versions of Lua, runs great, and is incredibly fast. I see Lua 5.5 as a different language than Lua 5.1, even though one can make a polyglot program which can run in both. Lua 5.1 is also the point from which a bunch of offshoots were made: luau (Roblox Lua), LuaJIT, etc.
I guess my point is that why it's not picked as large of a support. I can see that being a good reason for Lua in 2006 when JSON was still not as popular but for better or worser, it's taken over so having built in JSON support would help, especially for a language geared for configuration and data representation.
> Keep in mind that I have a fork of Lua which is 116,224 bytes in size (security hardened Lua 5.1 with `lfs` support); Lua is tiny and that’s why it does not have a built in JSON library nor will it wash the dishes for you.
Agree, that's where it really shines, it's small and embeddable.
> Lua 5.1 is also the point from which a bunch of offshoots were made: luau (Roblox Lua), LuaJIT, etc.
But you see how the official site doesn't seem to issue bug fixes for anything lower than 5.4 yet everyone says 5.1 is the version to stick with. And there is luau and LuaJIT as well, that I think explains a bit why people are embracing it as eagerly any longer.
https://pluto-lang.org/
The reason I like Lua is because I use it like a tiny Perl, but, unlike Perl, I already include the entire language with my open source project (it’s embedded in another program I wrote) so my Lua scripts in said project will run on any POSIX compliant system: The Lua fork I use and include also compiles as a standalone scripting language.
All the Lua 5.x versions that I have seen have small compatibility issues, and that's why many projects stick with what it's compatible with 5.1 only.
C++ doesn't have any "native json support" either, and that's fine. I don't think JSON is that critical. You can use a library for the kind of serialization that you want. Neovim uses JSON and Lua extensively, and it just uses a C library inside.
It's true that `{}` doubles down as an empty array or an empty map. It is not a problem that often, IME. You also can't signal that a certain key in a map is `nil`, but you can use a sentinel for it. You can do the same to disambiguate between these two.
Different features hit differently to different people. I agree that global by default seems so wrong, but I just go used to it, and I don't care anymore. To me, the main deal is not that Lua doesn't have this features by default, is more that, when I want them, there is no generally agreed library/framework that can plug all the features in a unified, coherent way. Penlight should be that, but I don't like it that much.
This is something that personally hits me the most, because I'm used to Qt. With Qt, I have tons and tons of functionality and a well established community and practices.
But you see how "why isn't Lua more popular" is answered with that? Do I start with 5.5? 5.3 and below seems is EoL already per the official site, they only have 5.4 bug fixes. It's a bit like C++ I guess, use only a small subset of features perhaps?
> C++ doesn't have any "native json support" either, and that's fine.
Unlike C++ Lua posits itself as an easy data representation and configuration language but it doesn't have a built-in way to load one of the most popular serialization formats out there these day.
> Different features hit differently to different people.
Definitely, I am just explaining why it doesn't appeal to me and the reason I heard other people didn't start or continue using it.
If it had a few changes and perhaps some optional additions (while keeping a "classic" or "standalone" version), it would probably be more popular.
> Unlike C++ Lua posits itself as an easy data representation and configuration language but it doesn't have a built-in way to load one of the most popular serialization formats out there these day.
But that's the thing: if you want to represent data or configure something, wouldn't you prefer to do it in Lua? Seems the history of the language was using Lua syntax for the data representation, which is a bit more convenient than JSON for a few schemas. JSON is useful for interoperability, but it's far from my favorite for making a configuration file. The next project I'm working on is a small Lua script that will let the user configure itself via Lua, because that's more convenient than a static config format.
https://pluto-lang.org
Lua has many quirks (global by default etc.) but with a language server like https://luals.github.io/, you can detect most of them easily plus optional type annotations.
I would love to see a POSIX standard for Lua (probably based on Lua 5.1); it’s widely enough deployed that a standard for it would make sense. Right now the standard is either PUC Lua 5.1 or whatever the latest release of PUA Lua is at a given time.
I prefer Lua over Perl/Python/Ruby because I know I can get a Lua runtime going in whatever environment I’m in—e.g. when writing my Lua book, I used my personal fork of Lua 5.1, but the person I was writing the book with was using Moonsharp (Lua in C#) since they were a C# developer. We could easily share code with each other.
If you need to access the data from a different language, you just load Lua in the other language.
[1] https://github.com/CorsixTH/CorsixTH/blob/master/CorsixTH/Lu...
[2] https://github.com/CorsixTH/CorsixTH/blob/master/CorsixTH/Lu...
[3] https://github.com/CorsixTH/CorsixTH/blob/gh-pages/check-for...
It was their answer to the old VFX industry default, RIB (or custom scene description) files (i.e. data) manipulated with "filters" or inline-expanded Python inside the "pipeline".
Didn't get traction but it was the right idea and they never discontinued support for it.
If you watch movies/series containing VFX you have seen CGI rendered with 3Delight. But most of it will have been intermediate .nsi files, not .lua.
There are a couple of snippets here that refer to it (search for @track):
https://www.lua.org/history.html
No thanks
"if you want to see "hello, world" printed 5 million times, run it in lua. lua's parser is designed to handle massive files with stride, which is fairly unique and quite necessary if lua is to be used for this purpose."
OK