1. What is lua&luaJit?
lua(www.lua.org)It is actually a scripting language developed to embed other applications
luajit(www.luajit.org)It is a just-in-time runtime compiler of lua, and it can also be said to be an efficient version of lua.
2. Advantages
1) Lua is a free, small, simple, powerful, efficient, and lightweight embedded scripting language, and the current distribution version 5.3.1 of Lua is only 276k. 2) It is a project developed in C, so it can run on most operating systems 3) Lua is currently the fastest scripting language, which can improve the flexibility of the language and maximize the retention speed 4) Its syntax is very simple, there are no exceptions 5) lua can also be used as an API for C
3. Inadequacies and differences
1) Lua does not have a powerful library, so many functions are implemented without the concise scripting languages such as python, perl, and ruby 2) Lua's exception handling function is controversial, although it provides exception handling functions for pcland and xpcall 3) Support for Unicode encoding is not provided in the LUA native language, although http://www.cppblog.com/darkdestiny/archive/2009/04/25/81055.html can be achieved through some compromises 4) It does not provide ternary operator operations for a?b:c, which is widely used in C++ 5) No switch... case... syntax, which can only be done through if: elseif.. elseif.. else.. end method 6) The continue syntax is not provided when looping 7) There are no operations such as a++ and a+=1, which are widely used in C++ 8) Lua's index starts at 1, not the familiar 0 (string, table) 9) When you assign an element to nil, it means that the element does not exist 10) The numerical type of lua is only number, and there is no distinction between int, float, double, etc 11) There is no concept of classes in lua, and their classes are implemented in the form of tables 12) Only nil and false in lua are false, and zero is true in lua 13) Many programs need to be marked with () to run, for example, a={["b"]=5}, print(a.b) can be runn, but {["b"]=5}.b will report an error, and ({["b"]=5}).b is required
4. Overview
In summary, LUA is a simple and efficient ngx_lua widely used in game logic development and server development.
Transferred from: https://blog.csdn.net/ugly_man_/article/details/48577007
Attached:
Lua and Luajit performance comparison test: https://blog.csdn.net/alexwoo0501/article/details/50618031
|