News for hackers. Stuff that matters.
Re:Lua vs Ruby benchmarks (similarly "high-level" languages,... by bayareaguy on Saturday January 31, 2009 @04:53AM (#459432)
I did not get the same behavior as you when I tried this just now

What version of lua did you use? Perhaps my version's # is buggy in addition to being weird.

Re:Lua vs Ruby benchmarks (similarly "high-level" languages,... by silentbicycle on Saturday January 31, 2009 @09:12AM (#459561)
This is one of the things expected to be fixed in 5.1.4, IIRC.

# works with an array-style table (consecutive integer keys, starting from 1) and not hash-style tables. Once you're familiar with Lua, you rarely confuse them -- they tend to be used very differently. Using the same variable type is mostly an efficiency trick.

I agree that counting from 1 is kind of annoying, but part of their reasoning was that Lua is targeted as a scripting language for niches that can include people who don't really program. They tried to keep "weird" programming stuff from obfuscating the tiny amount necessary for writing config or data files in Lua. It has coroutines, lexical scope, metatables, etc. when you use it for real programming, but they don't get in the way when you don't need them.

For example, from the data file for my laptop's wifi script:

   device="ral0"
   sudo=true

   Network { key="home", nwid="barbelith", wpa="..." }
   Network { key="sparrows", nwid="The Sparrows" }
   Network { key="schulers", nwid="schuler-alpine" }
Re:Lua vs Ruby benchmarks (similarly "high-level" languages,... by LogicHoleFlaw on Saturday January 31, 2009 @12:07PM (#459769)

  Lua 5.1.3  Copyright (C) 1994-2008 Lua.org, PUC-Rio
  >
This is using the Lua console installed by the the (excellent) Lua for Windows package.