Live data from Hacker News

I open sourced my game along with a tutorial on how to make it using Lua

github.com

21–30 of 96 posts

Re: I open sourced my game along with a tutorial on how to make it using Lua

#21
post #6

I've never heard of Lua, but now that I am looking at it, it seems very friendly. Love how they call things what they are, for example `local` is just a local variable, or `repeat X until Y` for a loop. It's a joy to see, to be honest.

1-index kept throwing me off though

The main problem with that decision is that every discussion having anything to do with Lua always devolves into repetitive bikeshedding about the 1-indexing.

Re: I open sourced my game along with a tutorial on how to make it using Lua

#22

I've never heard of Lua, but now that I am looking at it, it seems very friendly. Love how they call things what they are, for example `local` is just a local variable, or `repeat X until Y` for a loop. It's a joy to see, to be honest.

I was first introduced to Lua via World of Warcraft. It's the scripting language used for Interface Customization. https://www.wowhead.com/guide=5338/comprehensive-beginners-g...

Same here!

SQL, Lua, C++, and HTML all around 2006 to host private World of WarCraft servers.

Great talking point at my previous interviews.

Re: I open sourced my game along with a tutorial on how to make it using Lua

#23
post #6

Earlier quoted context omitted.

1-index kept throwing me off though

The main problem with that decision is that every discussion having anything to do with Lua always devolves into repetitive bikeshedding about the 1-indexing.

In the context of language design, the arguments for 0-based indexing rise above bikeshedding. https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/E...

Sure it may not be the most critical point about language design, but it's not just bikeshedding either. For one thing, it is a language semantics issue rather than plainly syntax issue.

I still like Lua, and maybe you don't even agree with Dijkstra's argument, which is also possible to make, but doesn't mean its bikeshedding - which seems to be a totally overused term to basically mean any argument I don't want to have.

Re: I open sourced my game along with a tutorial on how to make it using Lua

#24

Earlier quoted context omitted.

The main problem with that decision is that every discussion having anything to do with Lua always devolves into repetitive bikeshedding about the 1-indexing.

In the context of language design, the arguments for 0-based indexing rise above bikeshedding. https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/E... Sure it may not be the most critical point about language design, but it's not just bikeshedding either. For one thing, it is a language semantics issue rather than plainly syntax issue. I still like Lua, and maybe you don't even agree with Dijkstra's argument,…

Are you bikeshedding bikeshedding??

Just kidding, I actually agree with your point that the term is just demonstrate that you don’t want to have a conversation by diminishing the value of anybody having it.

Re: I open sourced my game along with a tutorial on how to make it using Lua

#25

I've never heard of Lua, but now that I am looking at it, it seems very friendly. Love how they call things what they are, for example `local` is just a local variable, or `repeat X until Y` for a loop. It's a joy to see, to be honest.

Check out (the now unfortunately named) CoronaSDK from (the also unfortunately named) Corona Labs. It's all Lua based and is now entirely MIT open sourced. One of the easiest to code cross platform development languages there is.

Renamed to Solar2D.

Re: I open sourced my game along with a tutorial on how to make it using Lua

#26
post #20

Earlier quoted context omitted.

I disagree. Particularly when parsing strings, it's useful if the upper bound of one substring is the lower bound of a nonoverlapping substring immediately after. For example, here's a routine to split a string into the part before the first dot and the part after: function split_dot(s) local idx = s:find(".", 1, true) if not idx then return s end return s:sub(1,idx-1), s:sub(idx+1) end It may come as a surprise that…

You wouldn't end up with this: s:sub(0, #s) You would end up with: s:sub(0, #s - 1) Which demonstrates the off-by-one error.

Can you explain what the intent of the code is and what the error is? It looks like the original code just grabs a substring containing the entire string. If the language used half-open intervals with an exclusive upper bound, the code I posted would also do that.

In python, for example, the operation of copying a list can be correctly written l[0:len(l)]. You're more likely to see l[::] or list(l) though.

Edit: I think maybe the proposed error that's being avoided is "a user tries to use a closed interval when sub takes a half-open interval." It seems like the opposite error is similarly likely though. Some areas where it's nice to have half-open intervals like using a modulus to restrict a value to an interval or parsing strings don't have such a symmetry.

Notably if you're making a binary heap the formulas come out much nicer with 1-indexing than with 0-indexing, but I haven't met any other examples where this is the case.

Re: I open sourced my game along with a tutorial on how to make it using Lua

#27
post #6

Earlier quoted context omitted.

1-index kept throwing me off though

The main problem with that decision is that every discussion having anything to do with Lua always devolves into repetitive bikeshedding about the 1-indexing.

I think the main problem with 1-indexing is that it makes some formulas that depend on the length of an array more complicated. Not a huge problem, but it's kind of annoying.

Re: I open sourced my game along with a tutorial on how to make it using Lua

#28

I've never heard of Lua, but now that I am looking at it, it seems very friendly. Love how they call things what they are, for example `local` is just a local variable, or `repeat X until Y` for a loop. It's a joy to see, to be honest.

Check out (the now unfortunately named) CoronaSDK from (the also unfortunately named) Corona Labs. It's all Lua based and is now entirely MIT open sourced. One of the easiest to code cross platform development languages there is.

Whoa! CoronaSDK got opensourced?! It was the hype back in 2012-15ish era. It and Ionic etc. Always wanted to learn something like that but never got beyond backend dev thanks to overloading office work by my jerk employer back then. Will definitely check it out now, now that I'm in a better place and have weekdays to myself purely.

Re: I open sourced my game along with a tutorial on how to make it using Lua

#29
post #6

I've never heard of Lua, but now that I am looking at it, it seems very friendly. Love how they call things what they are, for example `local` is just a local variable, or `repeat X until Y` for a loop. It's a joy to see, to be honest.

1-index kept throwing me off though

How about this: The empty string and 0 are truthy. Why?

Re: I open sourced my game along with a tutorial on how to make it using Lua

#30
post #8

For those interested, a very quick and easy way to start making games in Lua is with Roblox Studio. https://www.roblox.com/create

Roblox was strangely unmentioned in the online bubble I was living in before having a child. I discovered it only after I started searching for child-appropriate games, and even then initially dismissed it as "some dirtily monetized Minecraft clone", but it actually predates it, and is completely different.

As you mention, Roblox is actually a huge platform for creating games in Lua, and helping other players discover them. Not only do you get a cross-platform game engine with multiplayer built in, it also seems to be quite pleasant to develop for.

For instance, you can create both client-side and server-side Lua in the same IDE, and spin up a local server with a client that connects to it in a single click with no configuration. You can also add breakpoints and step through both sides in the debugger. Pretty awesome as I was used to client-side JavaScript and server-side Python before.

Because the platform encourages experimentation, I think we'll see many new game ideas and probably even new genres emerging from Roblox.

Post reply on HN