在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):ignacio/LuaNode开源软件地址(OpenSource Url):https://github.com/ignacio/LuaNode开源编程语言(OpenSource Language):Lua 63.7%开源软件介绍(OpenSource Introduction):LuaNodeAsynchronous I/O for Lua. LuaNode allows to write performant net servers or clients, using an asynchronous model of computing (the Reactor pattern). You might have seen this model implemented in event processing frameworks like Node.js, EventMachine or Twisted. In fact, LuaNode is heavily based on Node.js, because I wanted to be able to do what Node.js does, but using Lua instead of JavaScript. LuaNode is written using Boost.Asio. From its homepage:
That allows LuaNode to be cross-platform. It is mainly developed on Windows, but it is being tested also on Linux and OSX. Hello, worldThe following is the "hello world" of HTTP servers. local http = require('luanode.http')
http.createServer(function(self, request, response)
response:writeHead(200, {["Content-Type"] = "text/plain"})
response:finish("Hello World")
end):listen(8124)
console.log('Server running at http://127.0.0.1:8124/')
process:loop() To run the server, put the above code in a file luanode test_server.lua Then point your browser to You'll notice a striking resemblance with Node.js example server. In fact, I've aimed at keeping both, within reason, to be quite compatible. Code from Node.js can be easily rewritten from JavaScript into Lua, and with a few more tweaks, you can adapt code available today for Node.js. BuildingLuaNode can be compiled on Windows, Linux and OSX, using CMake. Although there are makefiles and projects for Visual Studio in the It is regularly built on:
LuaNode depends on the following: Debian installationIf you already have Lua, OpenSSL and Boost installed, you can use CMake to build LuaNode (thanks to Michal Kottman). Just do:
When building on ArchLinux, you need to change the install prefix, so the steps required are:
If you do not want to or cannot use CMake, the following has been tested on Ubuntu Desktop 10.10 / Debian testing.
When compiling on ArchLinux, the last step is this:
Note: This installation procedure will be simplified in the future. Mac OSX installationNote: Installation was tested on OS X Lion 10.7.5, OS X Mountain Lion 10.8 and OSX Mavericks 10.9 If you don't have boost or cmake installed, you can use Homebrew:
Compile from sources with cmake:
StatusCurrently, there's a lot of functionality missing. Doing a DocumentationSorry, I've written nothing yet, but you can get along following Node.js 0.2.5 documentation. The two most glaring difference between Node.js and LuaNode are:
The unit tests provide lots of examples. They are available at the AcknowledgementsI'd like to acknowledge the work of the following people or group:
LicenseLuaNode is available under the MIT license. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论