Lua language

thread to talk about and exchange knowledge on Lua and how to use it to program for norns and er-301

also see: https://forum.orthogonaldevices.com/t/middle-layer-sdk-aka-patching-with-lua/1235

15 Likes

Another helpful thread from O|D forum:

4 Likes

So (is this ā€œnew thingā€) is this written with lua??

No one knows, but my guess is its innards are largely C and there are some built-ins written in Lua against the same API that users will have access to. Lua is popular as a scripting-language add-on for C-based projects that value performance.

4 Likes

I’ve had some experience with Lua in regards to pure data but I guess as soon as Tehn releases the source we’re off to the races

2 Likes

Can we have an ELI5 description of Lua? Had a quick look at that O|D thread, and the Lua site, but I’m none the wiser beyond scripting DSP.

Lua is a simple scripting language - it’s not particularly complex to use, but it’s more like a language like Javascript than like, say, the Teletype script language. It has things like data structures and loops and logic and so forth. It is a long while since I’ve written any, so take this all with a pinch of salt. It is close-ish to what I’d call a ā€˜curly brace language’.

Lua is particularly popular because the interpreter is very small can be embedded inside C programs. One place you see it a lot is the games industry: the games engines are all C#/C++, but they often expose Lua as a scripting language for level designers to just drop things in ad-hoc, and so that scripting changes can be made very quickly - because it’s interpreted, you don’t need to run compilation for every alteration, just reload the scripts. Sorry, that paragraph was a bit complex.

Lua is a general purpose language. It’s not designed for DSP per-se. But just like the games example, if the DSP-type hooks are exposed, you could control DSP with it. (In the games example - the engine developers can add things that can be controlled by the Lua, and return data to it). So here, Teletype, if you know it, is a good example: Teletype itself is written in C. To add new functions to it, developers write some C. But once they’ve written that, anybody can access that functionality through the TT language as an end-user.

So: Norns itself is probably not written in Lua. It’s probably a lot of C, and it’s all sat atop Linux. But: my bet would be it then lets end-users write scripts/apps/whatever the term will be in Lua, if you’d like. (This basically solves one of the issues with Aleph - despite all the work to make things more straightforward, you still had to write a bunch of C to write apps).

I hope that’s a starting point, more an ELI12, @philmaguire, but maybe a start.

17 Likes

That makes a load of sense. Developing for Aleph always looked a bit intimidating to me.

3 Likes

http://terralang.org/

Ive been collecting a few other bits and pieces ill post up

2 Likes

@infovore is spot on. We have used a subset of Lua for our design scripting on the last 2 games we shipped. (Shadow of Mordor, Shadow of War) We implemented it because the embedded compiler was small with not a lot of overhead, and the language itself was very easy to for people to get their heads around (if they had done any scripting previously).

We have had a few hiccups in the last 9 years though (many may be on our implementation, and not a direct critique of the language). The first is that Lua is not type safe. This has lead to a number of weird bugs that were hard to track down. Which is directly tied to our second issue; we never implemented a run time Lua debugger. Which meant that debugging Lua scripts while the engine/game is running became particularly brutal.

All that being said I’m super happy this little guy is going to be running Lua, since it means I dont have to learn yet another scripting syntax.

2 Likes

A fun and easy way to get to know Lua is to trying making simple animations and interactive programs with LƖVE.

6 Likes

Hey @stripes, there are some good links in this thread for learning Lua.

https://studio.zerobrane.com

I’m pretty surprised this UCSB project hasn’t been mentioned, some someones must really like Lua over there

http://lua-av.mat.ucsb.edu

http://lua-av.mat.ucsb.edu/gallery.html

EDIT: https://github.com/LuaAV

shree@shree-linux2:~$ svn co https://svn.mat.ucsb.edu/svn/luaAV/trunk
svn: E170013: Unable to connect to a repository at URL ā€˜https://svn.mat.ucsb.edu/svn/luaAV/trunk’
svn: E670002: Name or service not known
shree@shree-linux2:~$

I have really zero experience with coding, but just started watching this:

And his approach seems pretty comprehensible, doesn’t it? Just for the very basics? He just released a episode 2 as well, so maybe it’ll be a more frequent thing. Anyways, thought this could be helpful for other beginners.

15 Likes

aspiring norns/grid owner here. wanted to share a couple open source projects for those interested in brushing up on lua who are on macos:

https://www.hammerspoon.org
lua powered ui scripting for working with macos apis.

http://commandpost.io
for any video editors, lua powered plugins for interacting with apple’s FCPX. already pretty useful but supports user created plugins. built on hammerspoon. use it frequently at work.

i am a hobbiest programmer and have been trying to wrap my head around moving my busted up applescript/python scripts over to lua since discovering these. watching the space with interest and hope i can pull the trigger soon.

2 Likes

found some fun stuff on youtube

1 Like

https://create.ucsb.edu/Publications/07_WakefieldSmith_ICMC_Lua.pdf