Lua - Part 7

http://blog.zot24.com/how-we-used-openresty-and-lua-to-improve-api-performance/


cgilua / sapi / wsapi - trying to understand

https://github.com/keplerproject/cgilua

https://keplerproject.github.io/cgilua/manual.html

https://keplerproject.github.io/cgilua/reference.html

https://keplerproject.github.io/cgilua/sapi.html

https://keplerproject.github.io/wsapi/

http://keplerproject.github.io/wsapi/libraries.html

https://en.wikipedia.org/wiki/Kepler_(software)

http://keplerproject.github.io/orbit/reference.html

https://keplerproject.github.io/wsapi/manual.html

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.

/usr/local/share/lua/5.3/wsapi/sapi.lua

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.

https://luarocks.org/modules/tomasguisasola/md5
luarocks install md5
http://keplerproject.github.io/md5/

https://luarocks.org/modules/leafo/mailgun
luarocks install mailgun
https://github.com/leafo/lua-mailgun
dependecies
LPeg
lua >= 5.1
lua-cjson
LuaSec
LuaSocket

i installed https://luarocks.org/modules/gvvaughan/lpeg
luarocks install lpeg


https://stackoverflow.com/questions/46262610/how-to-make-correct-http-post-request-with-key-valuekey-value-after-the-adress

https://github.com/nodemcu/nodemcu-firmware/issues/1707

https://stackoverflow.com/questions/43057560/lua-https-request-with-certificate

http://notebook.kulchenko.com/programming/https-ssl-calls-with-lua-and-luasec

https://github.com/brunoos/luasec/wiki/LuaSec-0.6#https_request


post request to ssl server

https://stackoverflow.com/questions/24379814/how-can-i-use-luasec-for-sending-in-https

more post info [X] http://forum.micasaverde.com/index.php?topic=32035.0

https://stackoverflow.com/questions/17372330/lua-socket-post

April 2018

July 2017 post:
"Why we rewrote Lua in JS"
https://hackernoon.com/why-we-rewrote-lua-in-js-a66529a8278d

April 2018 HN thread:
https://news.ycombinator.com/item?id=16732542

https://github.com/titan-lang/titan

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.

Coroutines

test-coroutine.lua
https://gist.github.com/giann/6a1cc45e36dd10afae30744f9b8193ac

Apr 6, 2018

luarocks install lua-resty-prettycjson

https://github.com/bungle/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"

messaging

http://nanomsg.org

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:

https://github.com/Neopallium/lua-nanomsg

https://github.com/nanomsg/luajit-nanomsg

https://github.com/arcapos/luananomsg