News for hackers. Stuff that matters.
Re:Lua, a Misunderstood Language (2021) by abeisgreat on Thursday September 29, 2022 @12:06PM (#33022608)
I highly recommend if you're interested in Lua checking out a few of my favorite Lua projects...

1. Moonscript (https://moonscript.org/) the compile-to-lua language powering Itch.io, it's amazingly pleasant to work with and I was amazed porting a JavaScript tool to Moonscript that the moon version was more readable despite my lack of familiarity with the language.

2. Redbean (https://redbean.dev/) the single-file, cross-platform binary magic web server that's been all the rage lately. Super fun to embed Lua apps into a single binary and build small web apps.

3. Pico-8 (https://www.lexaloffle.com/pico-8.php) the famed "fantasy console" a fake old computer with fake old requirements that forces you to get creative as you write games and apps with the limited resources, of course, all apps for Pico-8 are written in Lua.

I think the moral here (especially with the last two projects listed) if you like when computers get weird you'll like Lua. I also recently compiled the Lua runtime into wasm to make some of my scripts portable to the browser, it was simple and easy, including modifying the language code just a bit.

Lua is a little wacky, but there's something so fun it brings me back to the early days of writing code when everything was simple and just a little off.

Re:Lua, a Misunderstood Language (2021) by confident_inept on Thursday September 29, 2022 @12:44PM (#33023318)
I'll add LOVE (https://love2d.org) to that list as well. Very powerful and flexible game framework,

Currently working on developing a game in Minetest (https://www.minetest.net/), it is also scripted in Lua.

Re:Lua, a Misunderstood Language (2021) by bckr on Thursday September 29, 2022 @12:53PM (#33023490)
I'll add LOVR (https://lovr.org/), the 3D analog to LOVE. Haven't used it personally so ymmv.
Re:Lua, a Misunderstood Language (2021) by jmiskovic on Friday September 30, 2022 @06:24AM (#33033102)
LOVR is amazing and getting better each day. It's just amazing tool to throw up basic 3D playground for data visualization or for playing with visualized math. The interpreter is tiny in size but feature-full (drawing simple shapes & text, powerful low level graphics API, spatalized audio, physics engine!). Code is simple and elegant C. Community is tiny but wonderful and welcoming.

(disclamer, I'm a minor contributor)

Re:Lua, a Misunderstood Language (2021) by sph on Thursday September 29, 2022 @01:24PM (#33024107)
Any relation with LÖVE or is it just piggybacking on its name?
Re:Lua, a Misunderstood Language (2021) by keb_ on Thursday September 29, 2022 @02:53PM (#33025403)
It's piggybacking on its name because its API is heavily inspired by LOVE.
Re:Lua, a Misunderstood Language (2021) by pull_my_finger on Thursday September 29, 2022 @01:22PM (#33024070)
Odd to suggest that if they're interested in Lua, that they should check out Moonscript which is a different language altogether (although it compiles to Lua). But if you insist, something a little more Lua-ish is Teal[1] (gradual types ala TypeScript) or Pallene[2] (companion typed subset of Lua meant to generate optimized C libraries for use with Lua).

[1]: https://github.com/teal-language/tl

[2]: https://github.com/pallene-lang/pallene

Re:Lua, a Misunderstood Language (2021) by Benjamin_Dobell on Thursday September 29, 2022 @01:37PM (#33024353)
There's also my IDE which just bolts on types (both structural and nominal) to regular Lua - no transpiling as the types are defined with comments (or inferred).

https://github.com/Benjamin-Dobell/IntelliJ-Luanalysis/

Unfortunately, I haven't been able to give it as much attention as it deserves recently.

Re:Lua, a Misunderstood Language (2021) by jhbadger on Thursday September 29, 2022 @01:09PM (#33023825)
Also TIC-80, a fully open "fantasy console" that uses Lua by default, but also supports other languages like JavaScript and Fennel (a Lisp-like variant of Lua).

https://tic80.com/

Re:Lua, a Misunderstood Language (2021) by actuallyalys on Thursday September 29, 2022 @01:36PM (#33024336)
To clarify, Fennel compiles to Lua, so you can use it in most places that use Lua. TIC-80 appears to embed Fennel, so you don't have to bring the Fennel dependency.
Re:Lua, a Misunderstood Language (2021) by alwillis on Thursday September 29, 2022 @08:12PM (#33029106)
These aren’t Lua projects per se but they are configurable/scriptable using Lua:

Neovim [1] and WezTerm [2].

Neovim is the "hyperextensible Vim-based text editor”--quite the understatement IMHO.

WezTerm is an incredibly well done, GPU-accelerated cross-platform terminal written in Rust and uses Lua for configuration.

[1]: https://neovim.io

[2]: https://wezfurlong.org/wezterm/index.html

Re:Lua, a Misunderstood Language (2021) by SirAiedail on Friday September 30, 2022 @05:05AM (#33032643)
Also AwesomeWM [1], to continue the "Lua scriptable Unix desktop".

[1] https://awesomewm.org/

Re:Lua, a Misunderstood Language (2021) by coldacid on Thursday September 29, 2022 @04:02PM (#33026307)
I would add Defold to that list, it's a pretty nice little engine if you're making casual games. I used it for my team's project for this year's TOJam.

https://defold.com/

Re:Lua, a Misunderstood Language (2021) by maxdemarzi on Thursday September 29, 2022 @02:06PM (#33024788)
One Lua thing that is wacky is that you cannot have large integers as keys to a table. Lua converts {2938433:"hello", 983748323:"hi"} to positions in the array portion of a table and creates a giant 99.999% empty table eating all the RAM. Unless somebody knows something I don't on how to make it work.
Re:Lua, a Misunderstood Language (2021) by tkhattra on Thursday September 29, 2022 @03:05PM (#33025535)
i don't think that's true - lua stores sparse arrays efficiently. the table above should only have 2 slots allocated. see [1] or [4] for details on how lua implements sparse arrays.

[1] https://cacm.acm.org/magazines/2018/11/232214-a-look-at-the-... [2] http://www.lua.org/doc/jucs05.pdf

Re:Lua, a Misunderstood Language (2021) by maxdemarzi on Thursday September 29, 2022 @05:22PM (#33027389)
You are right. This code runs just fine on both of these online Lua websites. local tab = {} tab[938388893] = "hi" tab[987383332] = "Hello"

for k,v in pairs(tab) do print(k) print (v) end

https://www.lua.org/cgi-bin/demo https://luajit.me/

But when I try it using the Sol library (embedded in C++) it eats all my memory. Is it a Sol issue or a C Lua binding issue? Anybody know?

Re:Lua, a Misunderstood Language (2021) by tkhattra on Thursday September 29, 2022 @07:17PM (#33028662)
sorry, i'm not familiar with Sol. might be worth inquiring on the lua mailing list
Re:Lua, a Misunderstood Language (2021) by unsafecast on Thursday September 29, 2022 @12:36PM (#33023125)
> simple and just a little off.

Great way to put it. It's a very charming language. Once you learn the (very few) things that are off and can trip you up, it's really pleasant too.

Re:Lua, a Misunderstood Language (2021) by aiibe on Thursday September 29, 2022 @01:35PM (#33024318)
I discovered Moonscript with Lapis web framework. Then OpenResty (NGINX + Lua). Love it!
Re:Lua, a Misunderstood Language (2021) by prox on Thursday September 29, 2022 @01:07PM (#33023776)
The popular hit game Project Zomboid is also in Lua I believe.
Re:Lua, a Misunderstood Language (2021) by dboon on Thursday September 29, 2022 @02:16PM (#33024931)
I’ve just released a demo of my science fiction no combat RPG (think Disco Elysium), also made in Lua

https://spader.zone/firmament-1.0.0/

Re:Lua, a Misunderstood Language (2021) by absurddoctor on Saturday October 01, 2022 @10:43AM (#33046941)
The game itself is Java, but the mods are Lua