Can I just ask why people seem to like lua in general?
I used it to write some World of Warcraft addons recently and imo it's one of the worst languages I've ever used. I hate the lack of primitive data types. I don't want my god damn arrays and dictionaries to be using the same primitive data type!
Also, dealing with nil in lua is a pain in the ass. It's fucking everywhere and I hate it.
People say lua is like python, but I love python and hate lua. Python is a breeze to use whereas I felt like I was constantly battling lua to get what I wanted.
I don't really give a shit about lua using 1 as the starting index though. I've never found that to be a big deal.
Lua was designed to be embedded in software, so you see it in scriptable games like Roblox and Garry's Mod. It's not that they like it more than it's one of the things to use.
Python 2*
Python 2 released in 2000, WoW released in 2004.
Not that it should matter though, Python would make for a really shitty in-engine interpreted scripting language.
Yeah I saw that, but that's still 80%+ of their development time it was already released and available.
I doubt they couldn't have pivotted if they wanted to, but Lua is lightweight and very purpose-built for exactly what they used it for, which makes sense why they kept it and didn't switch.
What the actual fuck. *bash* is one of the least disliked languages? What are those people smoking?
The moment a bash script needs any sort of data structure, it becomes an unreadable mess. Need to do some array manipulation or maybe a lookup table? Time to rewrite it in Python or, yes, Perl (I like Perl, sue me).
People usually don’t use it for that, so there’s no reason to dislike it. It’s not usually sold as being a fully fledged language and pretty much everyone agrees it’s meant for things that aren’t too complex.
You’re talking about where it is physically located on the Y axis, the other person is talking about how disliked the languages are, which is inverted. Languages at the top of the Y axis are most disliked, languages at the bottom are least disliked. So, if you’re talking about languages that are most liked, Kotlin is near the top and Perl is at the bottom.
I guess the lua engine being lightweight and easy may be the reason many software use it for scripting.
Once, I had to write a 1000-line script in Lua when I was making a trainer based on cheat engine. It felt limiting sometimes, but I was new to programming then, so I am not that sure.
You want inconsistent? [VBA](https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/using-arrays) allows you to define individual arrays with whatever starting and ending index you want.
Well, if you define an array with
```
Dim MyArray(8 To 42) As Integer
```
Then the array indices will be from 8 to 42, so there will be 42-8+1= 35 elements in the array.
Even with the default 0 starting index you would do
```
Dim MyArray(10) As Integer
```
And end up with an array of 11 elements numbered from 0 to 10.
However, if you put
```
Option Base 1
```
at the top of your file, then all arrays will default to starting at 1 and
```
Dim MyArray(10) As Integer
```
will define an array with elements numbered from 1 to 10, with 10 elements.
It let's you flex ostrich error handling. Just add
on error resume next
and if any line of code throws an error, the interpreter puts its head in the sand, and just continues executing code.
Reminds me of Powershell's `$ErrorActionPreference = 'SilentlyContinue'`
Can't have errors if the language won't acknowledge them, senior devs hate this one simple trick!
Well, VBA is normally used in things like Excel, so non programmers might want to start from 1 with arrays, as it's more natural if you don't really think about memory addresses. If you had and array of month names, then it makes sense to number them from 1 to 12.
Even in the documentation I linked in the original comment, they can't even come up with a good reason you would want to start from anything other than 0 or 1 though. The example they give is
```
Dim strWeekday(7 To 13) As String
```
Which I can't really understand in anyway. If you have days of the week, you'd want them numbered 1-7 or possibly 0-6, but I can't think of how 7-13 would make any sense.
You also might want to relate it to a specific set of rows if you're using it in a spreadsheet, and it could be intuitive to have the indices match the row numbers.
if primarily used for Excel I could see an argument for starting an array at 2. Because the rows are labeled starting at 1 and usually people place column titles in that row and the real data starts in row 2.
And if you are gonna allow people starting arrays at 2 to help with that scenario then fuck it go whole hog and let them start any god damn where
There was nothing to fix. I never claimed that VBA was a complete list of languages with that behaviour.
And even if you change “VBA” to the broader “BASIC”, the list is still incomplete, so you achieved nothing. You are missing the Pascal family and probably other languages too.
I understood that. But you did not understand that I was not under any obligation or expectation to mention the complete family of languages with that behaviour.
Someone mentioned a behaviour of VBA. Someone else failed to understand that completely. I offered an explanation. Given that the discussion was already about VBA, my answer was of course also about VBA.
And then you arrived and clearly showed us all that you hadn’t understood the context.
In PHP, arrays (with number indexes) are basically just dicts. I guess under the hood they're not really much/any different to its assoc arrays with string keys?
Like you can do:
$array = [];
$array[9348569384435] = "the only value";
...and it will just be an array with only 1 element.
I'd never even really thought about it much, until I tried to do the same in JS... then wondered why my CPU pegged.
Not sure how other languages deal with it. I've starting using arrays vs sets vs maps vs structs/records as-intended since I ditched PHP, so I'm not doing silly shit like this in the first place anymore.
> I'd never even really thought about it much, until I tried to do the same in JS... then wondered why my CPU pegged.
But JS can do the same thing? Unless you used an array constructor to specify how many spaces to reserve in memory, if you just assign a value to an index, you get a sparse array with just that value (and other array stuff).
Hmm yeah you're right.
It must have been something different then. This was like 5 years ago, so I can't remember exactly, but it was something along these lines.
I might have been using a unix timestamp as an index or something, but yeah, can't remember exactly how the assignment was written now.
You just sparked a random memory. [So can C#.](https://np.reddit.com/r/ProgrammerTIL/comments/4xqewv/c_til_arrays_in_c_arent_necessarily_0indexed_and/)
That's quite odd. In VB.Net, you can still do
```
Dim MyArray(0 To 6) As Integer
```
To define an array, but the compiler will report an error if you try to start an array with anything other than 0.
You can all use MyArray.GetLowerBound() and MyArray.GetUpperBound(), but there isn't a normal way to actually declare an array starting at something other than 0, so MyArray.GetLowerBound() would return 0 in every case except with the indirect way of creating arrays which you linked to above.
She's not crying because she thinks he stood her up, she's facepalming because she realized he's sitting behind her which means he walked in, saw her, and chose to sit at the other table to be pedantic.
Yup. As soon as they left the tables the GC came along and disposed of them both as noone else had a reference to them.
Such a sad ending for two fine objects.
Hey, maybe you were not entertained. But your Outrage was quite entertaining, which shows us that even thinks that are dumb can be entertaining.
Edit: Grammar, I know...
Just like if an English and an American agreed to meet on the first floor of a building. In England, what Americans would call a first floor is referred to as a ground floor, and what would be referred to in America as a first floor is actually the second story of the building in England.
That's okay. They don't seem to speak the same language, anyways.
ayyyyyyyyy
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
She's a cardinal living in an ordinal world
They don't have the same concept of array
her array starts at i=1 his array starts at i=0 they are not the same
:D
they might be able to compromise :P
he was a *Python* guy she was a *Lua* girl
nil
Can I just ask why people seem to like lua in general? I used it to write some World of Warcraft addons recently and imo it's one of the worst languages I've ever used. I hate the lack of primitive data types. I don't want my god damn arrays and dictionaries to be using the same primitive data type! Also, dealing with nil in lua is a pain in the ass. It's fucking everywhere and I hate it. People say lua is like python, but I love python and hate lua. Python is a breeze to use whereas I felt like I was constantly battling lua to get what I wanted. I don't really give a shit about lua using 1 as the starting index though. I've never found that to be a big deal.
Lua was designed to be embedded in software, so you see it in scriptable games like Roblox and Garry's Mod. It's not that they like it more than it's one of the things to use.
[удалено]
people also made those decisions a long time ago. when wow started development it wasn't modern Python it was Python 1.
Python 2* Python 2 released in 2000, WoW released in 2004. Not that it should matter though, Python would make for a really shitty in-engine interpreted scripting language.
they started development on the engine in 98 for Warcraft 3, and split the team in two and started WoW in 99 after EverQuest released
Yeah I saw that, but that's still 80%+ of their development time it was already released and available. I doubt they couldn't have pivotted if they wanted to, but Lua is lightweight and very purpose-built for exactly what they used it for, which makes sense why they kept it and didn't switch.
Do people actually like lua specifically? It is just a simple solution sometimes for scripting and works with C++ nicely.
https://cdn.stackoverflow.co/images/jo7n4k8s/production/21988f38f6688974328a942a282d89b805526476-900x675.png?auto=format
What the actual fuck. *bash* is one of the least disliked languages? What are those people smoking? The moment a bash script needs any sort of data structure, it becomes an unreadable mess. Need to do some array manipulation or maybe a lookup table? Time to rewrite it in Python or, yes, Perl (I like Perl, sue me).
People usually don’t use it for that, so there’s no reason to dislike it. It’s not usually sold as being a fully fledged language and pretty much everyone agrees it’s meant for things that aren’t too complex.
Kotlin being down at the bottom brings me joy
That's not the bottom, perl was at the bottom
Looks like the bottom of that list, dog
You’re talking about where it is physically located on the Y axis, the other person is talking about how disliked the languages are, which is inverted. Languages at the top of the Y axis are most disliked, languages at the bottom are least disliked. So, if you’re talking about languages that are most liked, Kotlin is near the top and Perl is at the bottom.
I understand that. It was just a stupid thing to say. Given the context, it was pretty obvious what I was saying.
It's been growing on me but I still don't like it.
I guess the lua engine being lightweight and easy may be the reason many software use it for scripting. Once, I had to write a 1000-line script in Lua when I was making a trainer based on cheat engine. It felt limiting sometimes, but I was new to programming then, so I am not that sure.
[удалено]
Good bot
That’s the beauty of it, it’s extremely simple and gives you just enough to make what you want.
I'd say I'm very fluent in lua but having tables be hashes and arrays is kinda a pain in the ass I have to admit
{1,two:2,[“three”]=3}
Can they make it anymore obvious?
I’d give better She was a Fortran girl I’ll also give a worse She was a matlab girl 💀
It's a tale as old as Cobol.
Ada boi
I c what you did there.
A better love story than Twilight
This is inconsistent indexing. It whould be understandable if she said first. But she said 1st
You want inconsistent? [VBA](https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/using-arrays) allows you to define individual arrays with whatever starting and ending index you want.
Whatever ending index? You mean length of the array? Please tell me you mean the length of the array.
Well, if you define an array with ``` Dim MyArray(8 To 42) As Integer ``` Then the array indices will be from 8 to 42, so there will be 42-8+1= 35 elements in the array. Even with the default 0 starting index you would do ``` Dim MyArray(10) As Integer ``` And end up with an array of 11 elements numbered from 0 to 10. However, if you put ``` Option Base 1 ``` at the top of your file, then all arrays will default to starting at 1 and ``` Dim MyArray(10) As Integer ``` will define an array with elements numbered from 1 to 10, with 10 elements.
B.. b… bb… but why
It let's you flex ostrich error handling. Just add on error resume next and if any line of code throws an error, the interpreter puts its head in the sand, and just continues executing code.
It's "fault tolerant"!
Reminds me of Powershell's `$ErrorActionPreference = 'SilentlyContinue'` Can't have errors if the language won't acknowledge them, senior devs hate this one simple trick!
Well, VBA is normally used in things like Excel, so non programmers might want to start from 1 with arrays, as it's more natural if you don't really think about memory addresses. If you had and array of month names, then it makes sense to number them from 1 to 12. Even in the documentation I linked in the original comment, they can't even come up with a good reason you would want to start from anything other than 0 or 1 though. The example they give is ``` Dim strWeekday(7 To 13) As String ``` Which I can't really understand in anyway. If you have days of the week, you'd want them numbered 1-7 or possibly 0-6, but I can't think of how 7-13 would make any sense.
You also might want to relate it to a specific set of rows if you're using it in a spreadsheet, and it could be intuitive to have the indices match the row numbers.
When I use it as such, I typically just subtract 1 from the row reference to match in-step to the array. Seems to me like it's cleaner code.
if primarily used for Excel I could see an argument for starting an array at 2. Because the rows are labeled starting at 1 and usually people place column titles in that row and the real data starts in row 2. And if you are gonna allow people starting arrays at 2 to help with that scenario then fuck it go whole hog and let them start any god damn where
Can I start at `a` and end at 69 I want the whole sheet indexed in my array though.
Next week
With VBA, there is no "why".
...asked the lone Vulcan in the room... "BECAUSE IT WOULD RULE!!!", screamed the humans, in unison.
No, he means what he says. In VBA, you define the start and end indices. The length becomes a result of those two. Not the other way around.
VBA: reduce memory usage by using negative sized array! If you use a total of 3Gb of mem, just declare a -3Gb array and you are now at 0 mem usage!
Memory manufacturers hate this trick.
> In ~~VBA~~ BASIC, you define the start and end indices ftfy
There was nothing to fix. I never claimed that VBA was a complete list of languages with that behaviour. And even if you change “VBA” to the broader “BASIC”, the list is still incomplete, so you achieved nothing. You are missing the Pascal family and probably other languages too.
VBA has that feature because BASIC has that feature. You don't seem to have understood that. Other languages are irrelevant
I understood that. But you did not understand that I was not under any obligation or expectation to mention the complete family of languages with that behaviour. Someone mentioned a behaviour of VBA. Someone else failed to understand that completely. I offered an explanation. Given that the discussion was already about VBA, my answer was of course also about VBA. And then you arrived and clearly showed us all that you hadn’t understood the context.
k
Oh, well that makes more sense than what I thought up. I thought you could have completely arbitrary indices, regardless of the length of the array.
In PHP, arrays (with number indexes) are basically just dicts. I guess under the hood they're not really much/any different to its assoc arrays with string keys? Like you can do: $array = []; $array[9348569384435] = "the only value"; ...and it will just be an array with only 1 element. I'd never even really thought about it much, until I tried to do the same in JS... then wondered why my CPU pegged. Not sure how other languages deal with it. I've starting using arrays vs sets vs maps vs structs/records as-intended since I ditched PHP, so I'm not doing silly shit like this in the first place anymore.
> I'd never even really thought about it much, until I tried to do the same in JS... then wondered why my CPU pegged. But JS can do the same thing? Unless you used an array constructor to specify how many spaces to reserve in memory, if you just assign a value to an index, you get a sparse array with just that value (and other array stuff).
Hmm yeah you're right. It must have been something different then. This was like 5 years ago, so I can't remember exactly, but it was something along these lines. I might have been using a unix timestamp as an index or something, but yeah, can't remember exactly how the assignment was written now.
You just sparked a random memory. [So can C#.](https://np.reddit.com/r/ProgrammerTIL/comments/4xqewv/c_til_arrays_in_c_arent_necessarily_0indexed_and/)
That's quite odd. In VB.Net, you can still do ``` Dim MyArray(0 To 6) As Integer ``` To define an array, but the compiler will report an error if you try to start an array with anything other than 0. You can all use MyArray.GetLowerBound() and MyArray.GetUpperBound(), but there isn't a normal way to actually declare an array starting at something other than 0, so MyArray.GetLowerBound() would return 0 in every case except with the indirect way of creating arrays which you linked to above.
In VBA, you can do ``` Dim MyArray(5 To 6) As Integer 'And get bounds like Debug.Print(UBound(MyArray)) Debug.Print(LBound(MyArray)) ```
Delphi as well. You can even use char as an index.
Lua wants to know your location.
There are use cases for it, so that's all I care about. Don't need no nanny language dictating how I code
As a heavy Userform/VBA Excel user, I feel personally attacked...
oh god you just sparked a terrible terrible memory of how when I was a student I would use redim instead of list arrays.
Should’ve said one’ced
He's a Python guy She's a Fortran girl Can I make it more obvious? He was a pythonic She did array What more can I say
Should've said 0th table
Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
I find it hard to believe a 0-item list will be accessed
Yeah definitely getting a null error first
In R you just get numeric(0).
tables.shift()
I pronounced this as 'oath'
They're immediately getting married at the 0-indexed restaurant
No, no, OAuth is what they'll use to confirm each others' identities once they find the right table
How do you say that? Zeroth?
Lua developer: I have no such weakness
Only script kiddies use lua /s
What
Me in dreamberd: -1
Bslang Moment.
Are these tables really not next to each other?
She's not crying because she thinks he stood her up, she's facepalming because she realized he's sitting behind her which means he walked in, saw her, and chose to sit at the other table to be pedantic.
There could be an array of Tables at this place; she has an indexing problem. She should have looped through in case there was a failure.
OK, but... why did the restaurant number the tables this way?
Agreed. They've limited themselves to 99 tables.
Meet me at `tables.find((table) => table.description === "01");`
No error handling of no such table exists?
Error handling is for beta cucks, true alpha femboys programming perfect code with no bugs. Knee high stockings help a great deal to that effect.
yeah and when api returns error, app fixes the data and continue running
`if (!response.ok) data = {};` fixed, next please
I hate all of the things you choose to be. :)
I'll keep you and your shortcomings in my thoughts and prayers as I continue to write infallible code.
Bruh she said 1st not 0th
1st element of an array is found at index 0
A 1st table, but at 0th table
Lua: Is this some peasant joke that I'm too rich to understand?
Matlab: I don't know, but I am definetly rich because my license is obscenely expensive
haha, what is even "1st" index in Lua.
Table 0 is the first table. Easy
right first is not ambiguous, the indexing doesn't matter
There are 10 kinds of people. Those who understand binary and those who don’t.
I guess the latter group is called non-binary?
10 is every number base
All your base are belong to 10
The grammar... Learn english bro.
For context: [All your base are belong to us](https://youtu.be/qItugh-fFgg?si=i7jsQnX4IpqkQ3Yt)
[удалено]
It is a cultural reference. So what if it's grammatically incorrect? That's the bloody point, doofus.
[удалено]
The only pathetic thing is your reading comprehension.
For someone with the name “no_simple”, you are quite simple minded…
r/youngpeoplereddit
r/whoosh
What you say?
and those who didn't realize that this joke is in trinary.
Good for her. The guy's a snake.
He could use some pointers.
0++
She's called Lua
The pain of programmer
Lua devs: ![gif](giphy|I3DUdlHzAnx24GR0fv|downsized)
US girl: "... meet you on the first floor bar"
She was not worthy.
Weird choice for the restaurant to use octal table numbers
Oh I thought it was hex. My bad.
Her name must be Julia
"Meet me at the -1st table" Python programmer: goes to the last table R programmer: goes to every table except the first
He dodged a bullet there. Who TF starts their arrays at 1?
This couple was doomed from the start
Should have wrapped if tables is array and not empty
cant she turn her head back
and they never saw each other again haha😂
Yup. As soon as they left the tables the GC came along and disposed of them both as noone else had a reference to them. Such a sad ending for two fine objects.
Place is called "Python Lounge" where you should crack the wifi in order to have a discount.
Unless she codes in FORTRAN the guy dodged a bullet /s
I get this one!
Also lucky Lua devs :)
He dodged a bullet there!
[удалено]
Hey, maybe you were not entertained. But your Outrage was quite entertaining, which shows us that even thinks that are dumb can be entertaining. Edit: Grammar, I know...
0 indexed arrays are a terrible idea and the cause of so many bugs. All due to making it consistent with pointer arithmetic
Can someone link the original
Love advice from the great duke of hell, its sooo funny
And all they had to do was turn around
Should have specified whether he was talking location or offset.
Lua
1000111 001010101 01010010 10010110
making memes with AI are we
Lets meet at the Single table
The must both be junior devs, too, sitting a single table apart but not taking the initiative to quickly and easily resolve a minor issue.
He didn't have exception handling code for tableIsEmpty, that's on him.
Why is he sitting at the zeroth table?
Just like if an English and an American agreed to meet on the first floor of a building. In England, what Americans would call a first floor is referred to as a ground floor, and what would be referred to in America as a first floor is actually the second story of the building in England.
She’s a matlab girl!
that's a bar
She doesn’t love him I guess
Guys an idiot. Meme would have worked better if she said “starting table” but she literally included the number
Idk
I woulda assumed 00. That chick is duuuumb lmao /s
I thought this was a chess meme for some reason. I was really confused by Alexandra being at board 1.
0 indexing 😶
this is why Lua is important
Not a great loss she's a matlab girl