Hail, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the Achaea Forums! Please be sure to read the Forum Rules.

HTML5 Client Questions and Such

191011121315»

Comments

  • AntoniusAntonius Member Posts: 4,550 @@ - Legendary Achaean
    If that's supposed to be JavaScript, and N is the length of the array you're iterating over, that should be either for(var i = 0; i < N; i++) or for(var i = 0; i <= N-1; i++). If you include N, or even worse N+1, you're going to retrieve elements that don't exist, and unless your code explicitly handles undefined you'll end up with errors thrown.
  • AntoniusAntonius Member Posts: 4,550 @@ - Legendary Achaean
    Kiskan said:
    And from what I see, Lua is not "totally undoable", but it definitely throws me (though not as much as what I saw of JS, which made me nope nope nope out of the gate).  
    If your main argument is that Lua is confusing for a total novice programmer, then I don't really know what to tell you. I think if you struggle with Lua then you'll struggle with literally any other language a MUD client might choose to support; Python isn't really any easier to learn, and I don't remember the documentation being any better.

    My (almost totally uninformed) opinion is that well written - and, perhaps, this is where things start to fall down since the majority of players write the most atrociously formatted code - Lua is among the easiest of any code to read, because the syntax it uses is the closest to actual English.
  • NazihkNazihk Member Posts: 985 @ - Epic Achaean
    Antonius said:
    If that's supposed to be JavaScript, and N is the length of the array you're iterating over, that should be either for(var i = 0; i < N; i++) or for(var i = 0; i <= N-1; i++). If you include N, or even worse N+1, you're going to retrieve elements that don't exist, and unless your code explicitly handles undefined you'll end up with errors thrown.
    Yeah I realized that I messed that one up about 2 minutes too late
  • NazihkNazihk Member Posts: 985 @ - Epic Achaean
    Wait, no, I just meant that  i<=N is better than i < N+1 when he's doing lua for loops where N=5 is 1-5 instead of 0-4.

    I probably should avoid things like this at 3am. Bleh. 
  • AhmetAhmet Wherever I wanna beMember Posts: 3,370 @@ - Legendary Achaean
    @Nazihk
    First: for i=1,n,1 works just fine.

    Second: most iterating over tables uses ipairs(), so, theres that.
    Huh. Neat.
  • TectonTecton The Garden of the GodsAdministrator Posts: 2,503 Admin
    While I'm sure we could debate the merits of the various programming languages and their implementations, let's try to keep this thread for questions/feedback about Nexus please!
    KilianIniar
  • IniarIniar Member Posts: 79 ✭✭✭ - Distinguished
    Nazihk said:
    Wait, no, I just meant that  i<=N is better than i < N+1 when he's doing lua for loops where N=5 is 1-5 instead of 0-4.

    I probably should avoid things like this at 3am. Bleh. 
    Me too.
Sign In to Comment.