Copy
Lua news across the globe
View this email in your browser

Letter from the Editor

This summer brings us many new Lua libraries and applications. Lua continues to hold steady on the Redmonk Programming Rankings at number #20, powering countless applications, and services including part of Apple's iOS! Here's to another year of Lua!. 

P.S. The Sailor Web Framework is looking for maintainers.


Articles 

Lua in iOS 12 - A story of the Harvard architecture

Proceedings of Lua Workshop 2018 - Making Lua Great
Thermomechanical Simulations with Lua and Fortran - Who needs Julia ‽​
Lua Memory - Writable Byte Sequences in Lua
LuaRocks 3 - New features in the Lua de facto dependency manager
Scripting Linux System Calls with Lua - Lunar DevOps
Eiffel - Yet another way of multithreading for Lua
The Road to ARM - An Unfinished Tale
Rewriting LuaJIT - Why and How?
Lua 5.0+ Garbage Collection - Tl;dr: Mark and sweep GC replaced with Incremental GC

Lightweight Concurrency in Lua - How to change a lightbulb without somebody else stealing your ladder
Distributed Systems Rate Limiting with Lua and Redis - Aka leaky and token buckets in Lua
Create an IoT sensor with Lua and NodeMCU - Lua on the metal
Passing a Language through the Eye of a Needle (2011) - From the creator of Lua
Why we rewrote Lua in JS - Callback hell with Lua
Compiling and statically linking with LuaJIT - Civilized people don't need Go :)
Lua Metatables Tutorial [Video] - Lua videos!
x86 Emulator running in Lua running in JVM running in Windows - Doesn't run Doom
LuaTeX Comes of Age - Long live the old guard!

Contributing Editorial  

by Milo Christiansen, the author of Fengari
Reimplementing Lua: A few helpful hints for your own VM

implementation would be more trouble than it is worth. In Sometimes you have a project where access to a Lua VM would be a very nice thing to have. Sometimes using the referencethese situations you can often find a ready-made solution created in your language of choice by some kind soul, but once in a while there simply isn't anything that fits your needs.

At heart the Lua VM is a simple beast, and reimplementing it in another language is fairly straight forward. I won't go into a great deal of detail here, but I will give you a poke or two in a good direction to get started. Before you start, there are a few things you really ought to get: 
  • The bytecode reference is invaluable. This may or may not be complete, as when I used it (a few years ago) there was some stuff missing. The older 5.1 document and a bit of peeking at the official Lua source code will quickly fill in any holes it may have.
  • Speaking of the source code, you will need a copy. You won't need to look much up, but sometimes there is no substitute for just looking at the source. If you can find the source for implementations in languages similar to the one you are targeting, they could come in handy as well.
  • Last but not least, you need a copy of the Lua test suite. You probably won't be able to use these tests unmodified (since it is highly unlikely that you will implement all of the debug package for example), but they provide a solid starting point for your own tests.
First and foremost: Use luac. Do not write your own compiler. You may want one at some point, but while writing and testing the VM, compiler bugs are the last thing you want to deal with. The Lua binary format is simple and easy to load for the most part, so just use the reference compiler to start. Once you have a working loader, write some code to dump a Lua program as an assembly listing. This allows you to make sure your loader actually works and lets you test instruction decoding in one fairly simple bit of code. From here it is just a matter of writing the basic structure, then filling in the VM loop one instruction at a time. The instructions are actually pretty easy for the most part, the value stack, call stack, and types (particularly tables and meta-methods) tend to be the biggest issues. When in doubt about how to do something, it is often worth a peek at the reference implementation and/or other implementation in languages similar to the one you are using. For example, when I was writing my Lua VM I had two other implementations of older Lua versions I could look at written in the same language (they ended up being less helpful than I would have liked, but were still pretty useful).  

Writing a Lua VM is a good introduction to making VMs for scripting languages, and I found it to be quite a lot of fun!

Tools/Libraries/Books

Titan - Ahead-of-time compiled sister language to Lua 
Pallene - Statically-typed companions language for Lua. Fork of Titan.  

Eden - Lua in Clojure
Fengari XML - HTML Generation with Lua
APIGateway by Adobe - Lua API Gateway 
Lua utf-8 - UTF-8 support for Lua and LuaJIT
Lua in PostgreSQL - Embrace and Extinguish
RaptorJIT - LuaJIT fork optimized for low-level programming
Snabb - Lua Software Defined Networking
Studio - Smalltalk debugging environment meets LuaJIT

Learn to Code by Programming Bots in Minecraft - For the young'uns

 

Sponsored 

Ad

KloudTrader Narwhal - Commission-free algorithmic trading deployment platform 

Lua Jobs

Google Developer Advocate Firebase and Games


 
If you are interested in having your tool/library/article featured here or would like to contribute to the editorial, please email me.

Copyright © 2018 Lua Digest, All rights reserved.


Want to change how you receive these emails?
You can update your preferences or unsubscribe from this list

Email Marketing Powered by Mailchimp