lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Jan 30, 2018 at 2:08 PM, Soni "They/Them" L. <fakedme@gmail.com> wrote:
...
> We can argue about this all day but if I can do, in C++
>
> for (type i = min; i < max; i += step) {
> }
>
> Why can't I do
>
> for i=min,max,step do
> end
>
> in Lua? They should be equivalent.

Why should they?

In fact you cannot do the upper thing alone, you'll need some more
code. And you can do "int main(int ac, char **av ) {...." in C and not
in lua.

But, if you are thinking on counting loops, you can do it in both,
with any "countable" type. Lua just happens to have an streamlined
version for it's built in numbers.

Francisco Olarte.