Live data from Hacker News

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

github.com

41–50 of 96 posts

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

#43
post #6

Earlier quoted context omitted.

1-index kept throwing me off though

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

This is probably a good thing, if you don't want to have tickets filed about whether midnight (time of day) is truthy, whether Jan 1, 1970 is truthy, why some type of empty collection is truthy but others are not, etc.

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

#44

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,…

Roberto Ierusalimschy makes an interesting point on this in an interview[1] last year.

> When we started Lua, the world was different, not everything was C-like. Java and JavaScript did not exist, Python was in an infancy and had a lower than 1.0 version. So there was not this thing when all the languages are supposed to be C-like. C was just one of many syntaxes around.

> And the arrays were exactly the same. It’s very funny that most people don’t realize that. There are good things about zero-based arrays as well as one-based arrays.

> The fact is that most popular languages today are zero-based because of C. They were kind of inspired by C. And the funny thing is that C doesn’t have indexing. So you can’t say that C indexes arrays from zero, because there is no indexing operation. C has pointer arithmetic, so zero in C is not an index, it’s an offset. And as an offset, it must be a zero — not because it has better mathematical properties or because it’s more natural, whatever.

> And all those languages that copied C, they do have indexes and don’t have pointer arithmetic. Java, JavaScript, etc., etc. — none of them have pointer arithmetic. So they just copied the zero, but it’s a completely different operation. They put zero for no reason at all — it’s like a cargo cult.

[1] - https://habr.com/en/company/mailru/blog/459466/

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

#46
post #6

Earlier quoted context omitted.

1-index kept throwing me off though

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

0? Because Lua isn't C. It makes sense for C to treat 0 as falsey, because (void*)0 is Cs way of expressing a nil-value, as well as not having a dedicated boolean value to keep the language simpler.

Lua, both has a dedicated nil value and a boolean type, so there's no reason whatsoever to treat zero as falsey, other than the C cargocult.

As for empty strings, I really don't see the rationale behind it. An empty string is not nothing. At the very least, it still holds the length-data of 0, so it's conceptually more than just nil and should thus still be truthy.

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

#47

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.

A popular fantasy game console based around Lua

https://www.lexaloffle.com/pico-8.php

Celeste, a successful commercial game, was prototyped in Pico-8

https://www.lexaloffle.com/bbs/?pid=11722#p

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

#48

Earlier quoted context omitted.

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

This is probably a good thing, if you don't want to have tickets filed about whether midnight (time of day) is truthy, whether Jan 1, 1970 is truthy, why some type of empty collection is truthy but others are not, etc.

> This is probably a good thing, if you don't want to have tickets filed about whether midnight (time of day) is truthy

Agreed. Here is an example of exactly that in Python:

https://bugs.python.org/issue13936

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

#49

The author has some relevant blog posts (in GitHub issues) too: https://github.com/a327ex/blog/issues/35 - BYTEPATH Postmortem (2018) https://github.com/a327ex/blog/issues/44 - One Year Sales Data for BYTEPATH (2019)

I was not aware that Steam had changed their policy on sharing sales data. That is great! Are there any other indie devs that have shared the data about their Steam sales in a similar fashion? Better yet, is there a good list of links gathered somewhere for that?

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

#50
post #6

Earlier quoted context omitted.

1-index kept throwing me off though

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

If you make the empty string falsy, surely you need to make all empty collections falsy?

Python does this, which leads to people checking whether a list is empty using `if l` rather than `if len(l) > 0`. I‘d rather they stuck with “explicit is better than implicit”.

Post reply on HN