Lua - Part 7

cgilua / sapi / wsapi - trying to understand

The facilities above make it easier to write applications, but still are very basic. For more advanced web programming there are also frameworks built on top of WSAPI. Examples would be Orbit, which adds niceties as dispatch based on pattern matching over the PATH_INFO, easy serving of static content, easy access to databases, and easy page caching, and SAPI, included in the WSAPI package as the wsapi.sapi application, for running CGILua scripts and Lua pages.

CGILUA requires WSAPI.


March 2018 - i edited the following files. irritating. i had to do this in order to change the returned http status code to something other than 200. how in the hell is this not an option in cgilua? i added jrStatus to wsapi/sapi.lua which gets used by cgilua.lua.

i'll have to find another alternative. i don't understand how to use wsapi by itself. cgilua is built atop wsapi. maybe i'll try orbit.

or i need to figure out how to extend wsapi from my own code without editing those files.

i needed to edit cgilua.lua anyway to change "unpack" to "table.unpack". the latter is required for the code to work in lua 5.3.

March 29, 2018

To support Sora, my web-based static site generator, I installed the following.
luarocks install md5
luarocks install mailgun
lua >= 5.1

i installed
luarocks install lpeg

post request to ssl server

more post info [X]

April 2018

July 2017 post:
"Why we rewrote Lua in JS"

April 2018 HN thread:

Titan is a new programming language, designed to be a statically-typed, ahead-of-time compiled sister language to Lua. It is an application programming language with a focus on performance.



Apr 6, 2018

luarocks install lua-resty-prettycjson

cjson outputs json as one long string. in a text file, i'd like a pretty version.

local pretty = require "resty.prettycjson"


nanomsg is a is a socket library that provides several common communication patterns. It aims to make the networking layer fast, scalable, and easy to use. Implemented in C, it works on a wide range of operating systems with no further dependencies.

The communication patterns, also called "scalability protocols", are basic blocks for building distributed systems. By combining them you can create a vast array of distributed applications. The following scalability protocols are currently available: