Live data from Hacker News

Lua 5.5

lua.org

121–130 of 138 posts

Re: Lua 5.5

#122
post #95

I miss working in Lua. Metatables are pretty powerful, and "everything is in a table" made it super easy to do hot reloading. At one point working on an iOS game, I had things set up so that when I hit save on my PC, my phone would pick up the changes and just start running the new code, as all persistent state was stored in a special table. Someday I need to look into getting the same kind of environment going for r…

I'm building something like Lua for robots, you might want to check it out if you're looking to collaborate. I didn't know about Lua when I started it, but I did end up at an "everything is a table" metaphor because it seemed good for robotics. This does allow for cool things like hot reloading and such. Although, we've since moved to having several distinct data structures which conceptually map to tables, but imple…

> I didn't know about Lua when I started it

How did you miss Lua? It has been available for decades and good SE practice is to evaluate alternatives before commiting to any techonology.

Re: Lua 5.5

#123
post #4

One of the new features I found interesting, declarations for global variables, is buried in the reference manual. Here's a link to the section that discusses it: https://www.lua.org/manual/5.5/manual.html#2.2

Global-by-default scoping was one of Lua's largest mistakes. I wish they'd fix it, but of course it would break backwards compat.

yeah. I hate typing `local` for every variable. I would prefer they introduce some syntactic sugar like `let`(to mean local variable) and `const`(to mean local and constant).

Re: Lua 5.5

#124

Earlier quoted context omitted.

Global-by-default scoping was one of Lua's largest mistakes. I wish they'd fix it, but of course it would break backwards compat.

yeah. I hate typing `local` for every variable. I would prefer they introduce some syntactic sugar like `let`(to mean local variable) and `const`(to mean local and constant).

“local” is the same as the “let” that you are describing, isn’t it? Just 2 chars longer.

Re: Lua 5.5

#125
post #42

How hard is it to put a simple hello world example on the homepage.

Well. You’d have to demonstrate that a[1] is the first offset in an array, and it’s not a great curb appeal to anyone who has programmed computers before.

It makes sense when you look at how the numberic for loop looks in Lua.

In Lua you specify the “beginning” and “end” of the iteration, both included. It doesn’t work like in C, where you have an initialization and an invariant. What makes it short in C would make it longer in Lua, and viceversa.

You could argue “why not make loops like C”, then. But that can be extended to the limit: “why have a different language at all?”.

Re: Lua 5.5

#126

I recently happened into Balatro through a Game Pass trial. I fell deep down the rabbit hole of trying to get it to run on SteamOS. It's fascinating to see a commercial game whose source is easily read inside the application bundle, and all the modding opportunities it opens up. (It's written in Lua with LÖVE.) Balatro was one of the biggest games of last year, and I'm sure the tinkerability was a big catalyst to tha…

With a little effort you can get mods working on Android. I have the cryptid mod installed on my phone.

Re: Lua 5.5

#128
post #95

I miss working in Lua. Metatables are pretty powerful, and "everything is in a table" made it super easy to do hot reloading. At one point working on an iOS game, I had things set up so that when I hit save on my PC, my phone would pick up the changes and just start running the new code, as all persistent state was stored in a special table. Someday I need to look into getting the same kind of environment going for r…

I'm building something like Lua for robots, you might want to check it out if you're looking to collaborate. I didn't know about Lua when I started it, but I did end up at an "everything is a table" metaphor because it seemed good for robotics. This does allow for cool things like hot reloading and such. Although, we've since moved to having several distinct data structures which conceptually map to tables, but imple…

I think I could actually build what I was thinking of on top of basis, but need to think about some things. Serialization of internal state was kicked around as a design idea at the start, but didn’t see enough benefit back then. In any case basis isn’t quite dead, I still use the thing as a test bed for ideas.

I’ll take a look at your thing, too!

Re: Lua 5.5

#129

Earlier quoted context omitted.

i think i might prefer indexing starting at zero, but it really isn't important. with c it makes total sense for zero-based indexing. frankly though, for lua, how it works and what an array is, it makes more sense for one-based indexing, the only counter-argument being that 1-based indexing puts off people who learned a thing one way and are unable or unwilling to do it a different way. to even include it on a list o…

> either way, at least you can't toggle between indexes starting at zero and one You can, you just have to explicitly assign something to a[0]. Lua doesn't have real arrays, just tables. You have to do it for every table you use/define though, so if you mean "toggle" as in change the default behavior everywhere then I believe you are correct.

iirc that value at key zero won't be included in any array handling functions. if that behavior were toggleable we'd have the kind of nonesense that early APLs allowed before they realized that's a bad thing to stuff in a global variable you can write to at any time in your program.

Re: Lua 5.5

#130
post #77

Earlier quoted context omitted.

You kind of always have to go on a quest for a library on the internet, why would lua be any different? For lua, luarocks is its module registry and you can sort by most downloads, which sometimes leads you to buggy modules, but what can you do.

> You kind of always have to go on a quest for a library on the internet Plenty of languages come with standard libraries that are more than sufficient for handling plenty of tasks.

There's nothing stopping anybody from making a batteries included lua, and plenty have done so (emilua, luapower, luaforwindows, luart and etc), of course, pure lua still exists and their changes are usually backported into lua since its so small and portable.

FWIW you can do a lot with pure lua and unless you're importing json there's no reason to include a library for it given that lua itself can be used as the data exchange format.

Post reply on HN