4 ms·
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.
by bayareaguy 18y ago
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.
- silentbicycle 18y agoThis 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" }
- LogicHoleFlaw 18y agoLua 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.