Luan / Documentation reactionary software by fschmidt

Learning Luan

To understand the idea behind Luan, you must read Ousterhout's paper. In terms of this paper, Luan is the scripting language and Java is the system programming language. In other words, these two languages are a pair of tools that work together. Luan is the tool for writing applications, and Java is the tool for writing libraries.

No other modern scripting language (except Tcl) follows this model. This means that you are limited to whatever functionality the scripting language provides. Of modern scripting languages, only Python is big enough to really have enough functionality through libraries. But tiny Luan has as much functionality as Python does because Luan has access to all of the functionality available in Java.

It is the tight integration of Luan with Java that makes this possible. Often, making a Java function available in Luan is as simple as:

Luan_table.luan_function = JavaClass.javaFunction

In other cases, there is a very thin layer between Luan and Java. And if you know Java, then this code is easy to read. This means that the Luan source code is actually perfectly suitable documentation for the Luan API. If I was to document all of the Luan API, I would actually be mostly duplicating the Java API documentation. So while I will continue to expand the Luan Reference Manual, this is not my top priority. To use Luan, you must get the source and get a basic understanding of the API which is in luan/src/luan/modules.

Here are my suggested steps for learning Luan:

  1. Follow my Learn Reactionary Programming course up to and including Java 8.
  2. Read Programming in Lua. It is actually an excellent book which means that I don't have to write an extensive Luan tutorial. Then read How Luan differs from Lua.
  3. Next read the short Luan Tutorial.

What comes next depends on whether you want to do web development or desktop development.

For web development, start by looking at the example in luan/examples/blog. This is a minimal website. Next look at Luan Chat. Get the source. It uses server-sent events which is implemented in Luan with Http.push. Luan Chat is fully functional and is what I use to chat with people. So this code is an example of a complete website.

For desktop development, you need to learn the relevant Java tools which include Swing, MigLayout, FlatLaf, and 2D Graphics. Then you can look at examples in luan/src/luan/modules/swing/examples. And then get Luan Editor. This is a fully functional text editor. It will show you how to use Swing in Luan.

With popular programming languages, you can get help from ChatGPT. But ChatGPT doesn't know Luan. ChatGPT can help you understand Java, but that's all. So for Luan questions, just contact me.