For me the thing that stopped me from having any interest in PICO-8 was the code size limit. Lua just made it even less appealing and I just continued to do NES stuff instead.

This is the second fellow brewer I've heard say they don't like Lua. Out of curiosity, what do you (or anyone else) dislike about it?

I like it because of how little ceremony it has to the syntax. I also like how easy it is to pass functions around as data. The consistent KEYWORD....END syntax is nice, too, instead of being forced to use tabs as in python for instance. I like that everything is a table.

Perhaps the only thing I find odd is tables starting at 1 instead of 0. Takes some getting used to. That's the only wrinkle I've found so far really. The rest of it is really fun to work with.

*edit* Oh! And coroutines! Lua's the first language where I successfully applied coroutines. No, wait, I did that in 6502 first...haha (thanks for the idea tokumaru!). Coroutines make state machines in games really really nice to work with.

I was gonna ask the same thing about why people don't like Lua. Just picked it up a few days ago to experiment with scripting in FCEUX, and honestly I love the language already. I've been converting some of my python tools for fun, and the source has generally ended up smaller and neater so far.

A typical data conversion tool in my NES toolchain is pilbmp2nes.py. Had I made it in Lua instead, I would have run into at least these problems:

Tables start at 1, making line-by-line hand translation of programs in other languages that much more error-prone.

No integer type, instead relying on the FPU. (JavaScript has the same problem.)

No bitwise operators prior to 5.3. Data converters tend to need them, particular when CHR data and compression are involved.

Python 3 is installed by default in modern GNU/Linux systems. Lua isn't.

Code:

The program 'lua' is currently not installed. To run 'lua' please ask your administrator to install the package 'lua5.2'

What's the widely used counterpart to Pillow, the Python imaging library?

It always seems like the ecosystem of a given language has so much to do with which domains it becomes successful in. I have a bunch of python tools as well, I'm very happy with those and will not be rewriting them a third time. Definitely enjoying lua for fceux debugging and also in pico 8 though.

Back when I needed an embedded scripting language, besides the 1-based counting, I chose not to use LuaJIT because it was so huge. Even it it's fast, that's not something I'd be able to debug at all, when something breaks, and something always breaks.

I chose JimTCL instead, which was comparably tiny and very debuggable, even if slower.

A typical data conversion tool in my NES toolchain is pilbmp2nes.py. Had I made it in Lua instead...

The typical usage of Lua is embedded into another application to add scripting capabilities. That's what it was designed for. It doesn't normally appear as its own stand-alone OS level application.

tepples wrote:

What's the widely used counterpart to Pillow, the Python imaging library?

If Lua is embedded in an application that works with images, it might have access to that application's imaging capabilities. Lua libraries do exist, but because the usual application is as an embedded lightweight scripting augmentation, generally the implementation wouldn't want or need to include many libraries. (The same is true of embedded Python usage, too.)

In addition to weird syntax, Lua has weird behavior that differs a lot from other languages and can create traps for people who aren't aware of them or who forget:

Lua doesn't differentiate between nil and an undefined variable. If you typo a variable name, it will just have the value of nil and you won't get an error. If you put nil into an array, it becomes a table instead and loses an array's speed benefits, also making the # operator incorrect. I've seen other people tweet about problems that they traced back to some variable name being typoed.

Starting at 1.

No switch statement so you have to do weird workarounds. Same for if you want OOP features or try/catch.

Boolean expressions act weird. 0 and 1 are both true, but not 0 and not 1 are false?

For my own projects I've always used Squirrel, which looks and behaves a lot more like C. It's very easy to move algorithms back and forth between Squirrel and other languages, and I've adapted code I've found written in JavaScript before.

That said there are some features in Lua that I wish I had in Squirrel, like goto and a JIT version of the language. Try/catch provides a lot of the use case I normally have for goto though.

What has already been said. Although to be fair I was seeing LUA 2~3 and by 5 it seems to have grown a lot( I'm also surprised it still is growing, mentally I have it filed with Perl), but its point was to be a small simple scripting language, but it started to suffer from "shiny hammer" syndrome. I feel that GameMonkey was a better product for the purpose. And going from GameMonkey to LUA felt like going backwards ( yes I know LUA came before )Other crimes in my book- Garbage collection - JIT- Dynamic- DuckThis tends to give it a large resource impact, random CPU usage and make the code hard to follow after coming back to it. It tends to be string heavy which only compounds the problems.

Again fine if you are doing a 256 line script for something like a PC, but not something you want to make a game in, not something you want to make a game in for a resource bound machine. Not something you want to use on a machine where you limit the size and number of commands, where said size is based upon the "byte encoded" size that changes depending on what and how you do something, with no clear 1:1 ratio. To me LUA is a better VBA, and I would rather use in a situation where I would consider VBA, only VBA is built into Windows and hence comes "for free" so I just use VBA But if I wasn't on Windows then the door is open.

Having ints now is nice Although tepples doing an | 0 in JS is a nice hack to force an int, as you can't do binary maths on a float Doing |0 before sending values to a canvas to render gives a nice speed boost Although having the "its not bad, if you do <insert hack here>" is basically pointing out their is a problem And the problem probably is your trying to use it to do something it wasn't meant to do

To add to the list of complaints, if you forget local when defining a variable, it will define a global variable (or modify an existing one) instead.

JavaScript without "use strict" has the same problem. So do C and C++ if a global variable happens to have the same name and type as the local variable you forgot to declare. For comparison, in Python, global variables are read-only without the global keyword, and in PHP, global variables aren't even in scope without the global keyword unless they're variables defined by the interpreter (mostly $_REQUEST and $_SERVER).

I think that each program can do one thing, so you don't (usually) need the picture format conversion between two formats in one program, and can just convert one format. You can use one program for sort, one program for shuffle, one program for make audible on speaker, one program to rasterize for printing, one program to convert into format for printer, one program to send it to the printer, etc.

I don't like the 1-base tables in Lua either, although, that is what it is.

Who is online

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum