[Original] merge static files on the Nginx + Lua Server
0x01. About
Source code has been uploaded to github: https://github.com/grasses/nginx-lua-static-merger
Nginx-lua-static
[Original] Nginx + Lua server merges static files, nginxlua
Http://homeway.me
0x01. About
Source code has been uploaded to github: https://github.com/grasses/nginx-lua-static-merger
nginx-lua-
AboutLua source fileAnalysis is the content to be introduced in this article.LuaOfSource FileI think that as a beginner, I should learn and understand these content. For details, refer to this article.
Lua5.1.4 The core source code contains 55 files, which are roughly analyzed as follows:
Lapi. c // Lua API, C calls API
Lapi. h // Auxiliary functions from Lua
store a large number of short snippet. I wrote the COCOS2DX enumeration value complement in this way
D.buffer: Is the St. with the complete word of this document
E. Deficiencies
The above complement method, which is simply a text-level match, cannot be used to restrict the completion of the content based on the current context, as the IDE does with the static language. It seems that the intelligent perception of dynamic language, this is more diffic
This article focuses on the string Cache Management in Lua (the file lstring. c involved ).
Among the nine Data Types of Lua, the string is a type that can be recycled by GC. In Lua, the Operation string is actually referenced in the Operation string. When the character string is not used, GC will be recycled by some algorithm.
-- Lua9 data types:
# Define lua_
, lcode.c : Recursive descent parser, targetting a register-based VM. Start from Chunk () and work your IT through. Read the EXP Ression parser and the code generator parts last.
LGC.C : Incremental garbage collector. Take your time.
Read all the other files as you see references to them. Don ' t let the your stack get too deep though.
These are the LUA source reading sequences recommended by Luajit au
function. The default allocation function, which uses the Malloc-realloc-free function in the C standard library, is sufficient for a normal application, however, it is easy to gain complete control over the LUA memory allocation, simply by using the original lua_newstate to create the state:
Copy Code code as follows:
Lua_state *lua_newstate (L
Analysis on Exception Handling in Lua Programming
This article mainly introduces the exception handling in Lua programming, which is the basic knowledge in Lua beginners. For more information, see
Error Handling required
Error handling is necessary because operations in the real world usually require complex operations
-- Lua tables analysis (1)Bitbull.cn@gmail.com-- Reprinted, please maintainArticleComplete-- Ver 1.0 @ 2007/07/09 The tables of Lua implements an associated array, which means that data can be retrieved not only by numerical subscript, but also by other types of values. all types except nil in Lua can be used as index
Previous Chapter Portal: http://www.jb51.net/article/55088.htm
In this chapter we'll learn a little demo, the scene from the previous chapter: C + + Gets a string of global variables from LUA.
1. Introduction of header Files
Let's take a look at what we need to use LUA in C + +.
Copy Code code as follows:
LexState and FuncState struct variables. The LexState function not only saves the current lexical analysis status information, but also saves the global status of the entire compilation system, funcState struct to save the status data compiled by the current function. In the lua source code, there will be a global function execution body, that is, main func. At
1. Ngx_lua nodejs php comparisonAfter studying for a while, I found that the LUA syntax and JS really resemble each other, while the Ngx_lua model is also single-threaded asynchronous event-driven and works the same way as Nodejs, and the code is even better written than the Nodejs asynchronous callbacks. Ngx_lua Performance test, 100 concurrent php:17400nodejs:31197ngx_lua:32628Simply doing the HTTP proxy
scenes folder, Which is modeled after mainscene. Lua. Let's tap the Code:
local MyScene = class("MyScene", function () return display.newScene("myscene") end) function MyScene:ctor() end return MyScene
So even if the new scene, let's add some warm screen, show the classic cocos2d-x screen, in the next note to explain the addition of these genie text.
Copy the helloworld.png
we use the Lual_dofile function to execute this LUA script source, there are two phases, the first is to load the script into memory, parse and generate the bytecode, and place the entire package as main chunk on the LUA stack stack, and the second is to call Lua_ Pcall execute this chunk, here we will only analyze the first process.
A few previous articles said that when Dofile would run to a function ca
extension:This has been introduced in previous articles. Here is only an example of iup. button {Title = "OK", id = "btn_id"}. You can directly reference btn_id to indicate this button. The source code is in iup/iupid. in Lua.
Iv. vswizard. dll fileIt mainly provides the template file analysis function under the template directory and some auxiliary functions fo
= EPOLLOUT,EPOLLRDNORM = EPOLlrdnorm,epollrdband = Epollrdband,epollwrnorm = Epollwrnorm,epollwrband = Epollwrband,epollmsg = EPOLLMSG,EPOLLERR = Epollerr,epollhup = Epollhup,epollrdhup = Epollrdhup,epolloneshot = Epolloneshot,epollet = EPOLLET,};*/At this point, execute in LUA:Local Epoll = require ("Epoll") Local EPFD = Epoll.create ()Call the function named Create in Epoll table, which is ep_create, and take a look at its implementation:static int ep_create (lua_state *l) {int epfd;if ((Epfd
Overview
LUA is fully 8-bit encoded, and the characters in the LUA string can have any numeric encoding, including a value of 0. That is, any binary data can be stored in a string. The LUA string is immutable (immutable values). If you modify it, you are essentially creating a new string. In Lua, strings are the objec
Static keyword memory analysis and static keyword Analysis
Generally, Java divides memory into stack memory, heap memory, and method areas. stack memory is used to store some basic types of variables and arrays (arrays are also a reference type) and object reference variables, and the heap memory is mainly used to plac
Js object-oriented static method and static property instance analysis, js instance analysis
This article describes the js object-oriented static methods and static attributes. Share it with you for your reference. The specific
It can be said that Lua is called an interpreted language because there are functions such as load, because such a function allows Lua to execute dynamically generated code. The following is a detailed analysis of these functions.
Load function
The Load function prototype is as follows:
Copy
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.