LUA-based Web script development language Cgilua (RPM)

Source: Internet
Author: User

Here we introduce the Web development language based on Lua scripting, Cgilua

Introduced

Cgilua using LUA is a server-side scripting language for creating dynamic Web pages. Support for pure LUA scripts and Lua pages (LP), Cgilua. A LUA script is a LUA program that creates the entire contents of a Web page and returns it to the client. The LUA page is a regular tagged text (html,xml, etc.) file that uses some special tags in the embedded LUA code. These tags are processed by the Cgilua and the results page returned to the client.

Lua scripts and Lua pages are equally easy to use, and choosing one of them depends primarily on the characteristics of the resulting web page. When it is easier to separate the LUA page logic and format, LUA scripting is more suitable for creating web pages, simpler structures, but requiring more meaningful amounts of internal processing.

Allowing both methods to be mixed, Cgilua provides a great deal of flexibility for Web application developers when these two requirements are present. A detailed description of the scripting methods and some application examples are found in Lua scripts and LUA pages.

Building

The Cgilua architecture is divided into two tiers. The lower level is represented by the Server API (SAPI) and the high level of the Cgilua API itself. SAPI is the interface between the Web server and the Cgilua API, so it needs to implement each Web server and launch method.

A transmitter is responsible for Cgilua interaction with the Web server, implementing SAPI such as using ISAPI Mod_lua IIS or Apache. The reference implementation of the Cgilua transmitter is Kepler.

The Cgilua API is implemented using only SAPI and is fully portable to support Web servers in different transmitters. This way, any LUA script or LUA page can be used by any emitter.

Request Life cycle

The Cgilua process requests the use of CGI metaphors (even if the emitter is not CGI-based) and requires a life cycle that can be customized by the programmer. The life cycle of the Cgilua request consists of the following steps in the order of each request:

Add default handlers such as Luascripts and LUA pages and normal file formats.

Executes the Config.lua file, allowing for next customization.

Establish Cgilua.post and Cgilua.query tables (after processing and querying data).

Change the user script directory.

Perform the open function of registration.

Execute the requested script in the correct environment.

Perform the registration shutdown feature.

Change back to the original directory

Edit the Config.lua file to customize the Cgilua behavior. A typical use would be to register the opening and closing functions to alter the request processing behavior. This customization can implement new features such as session Management and Private library catalog profile morphology display, even in the entire Cgilua lifestyle implementation of new abstractions, MVC frameworks such as tracks.

Cgilua Download

Text for Luaie original article Web script development language based on LUA Cgilua

This article link address: http://luaie.paobuke.com/lua-web-develop-language-cgilua.htmlhttp://luaie.paobuke.com/ Lua-web-develop-language-cgilua.html

LUA-based Web script development language Cgilua (RPM)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.