• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

pguillory/luajit-libuv: LuaJIT FFI binding for libuv

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

pguillory/luajit-libuv

开源软件地址(OpenSource Url):

https://github.com/pguillory/luajit-libuv

开源编程语言(OpenSource Language):

Lua 96.3%

开源软件介绍(OpenSource Introduction):

luajit-libuv build status

This project provides a LuaJIT FFI binding to libuv, the async I/O library powering Node.js. It uses Lua coroutines to provide non-blocking I/O with synchronous syntax.

For example, you can build a web server that performs I/O (like reading a file or talking to a database) while generating each response, and it will process multiple requests simultaneously.

local http = require 'uv.http'
local fs = require 'uv.fs'

http.listen('127.0.0.1', 8080, function(request)
  return { status = 200, body = fs.readfile('README.md') }
end)

Or you can perform multiple HTTP requests simultaneously.

local http = require 'uv.http'
local parallel = require 'uv.parallel'

local requests = {
  { url = 'http://www.google.com/' },
  { url = 'http://www.bing.com/' },
  { url = 'http://www.amazon.com/' },
}

local responses = parallel.map(requests, http.request)

Status

Not production ready. Under active development. The API is unstable.

Requirements

  • LuaJIT. Regular Lua won't run it. That said, you probably want LuaJIT anyway.

  • Standard build tools.

  • libuv and http-parser are bundled and do not need to be installed separately.

Installation

git clone https://github.com/pguillory/luajit-libuv.git
cd luajit-libuv
make
make install

API Reference

Functions are divided into submodules. Each submodule can either be required directly or accessed indirectly through the uv module:

local fs = require 'uv.fs'

local uv = require 'uv'
local fs = uv.fs

Contributing

Your contributions are welcome! Please verify that make test succeeds and submit your changes as a pull request.

See Also

Other people have done things like this.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
AndreiRudenko/linc_luajit: Haxe/hxcpp @:native bindings for LuaJIT.发布时间:2022-08-16
下一篇:
mirven/luaspec: A specification framework for lua发布时间:2022-08-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap