(PoE is a awesome ARPG with a massive build customization and I believe inspired game creates by OP)
I open sourced my game along with a tutorial on how to make it using Lua
41–50 of 96 posts
Re: I open sourced my game along with a tutorial on how to make it using Lua
#42Re: I open sourced my game along with a tutorial on how to make it using Lua
#43Earlier quoted context omitted.
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
#44Earlier 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,…
> 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.
Re: I open sourced my game along with a tutorial on how to make it using Lua
#45Re: I open sourced my game along with a tutorial on how to make it using Lua
#46Earlier quoted context omitted.
1-index kept throwing me off though
How about this: The empty string and 0 are truthy. Why?
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
#47I'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.
https://www.lexaloffle.com/pico-8.php
Celeste, a successful commercial game, was prototyped in Pico-8
Re: I open sourced my game along with a tutorial on how to make it using Lua
#48Earlier 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.
Agreed. Here is an example of exactly that in Python:
Re: I open sourced my game along with a tutorial on how to make it using Lua
#49The 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)
Re: I open sourced my game along with a tutorial on how to make it using Lua
#50Earlier quoted context omitted.
1-index kept throwing me off though
How about this: The empty string and 0 are truthy. Why?
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”.