TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Lua/APR - proper standard library for Lua

100 pointsby piranhaalmost 14 years ago

8 comments

davidhollanderalmost 14 years ago
Only downside with LuaAPR is you're back to writing Apache style servers, with an OS thread for every connection instead of using non-blocking sockets where possible (Didn't find any support for nonblocking sockets or a select\poll variant in the linked docs)<p>For my Lua server [1] I currently use the nixio library from the LuCI project and polling instead[2]<p>Although the downside of both nixio and Lua/APR library is the use of compiled C bindings to manually interact with the virtual machine.<p>The exciting development with LuaJIT is the high performance FFI that allows you to make system calls and create structs directly from in Lua[3], so I am currently considering switching from nixio to ljsyscall when I do a new version [4]<p>[1]<a href="https://github.com/davidhollander/ox" rel="nofollow">https://github.com/davidhollander/ox</a><p>[2]<a href="http://neopallium.github.com/nixio/" rel="nofollow">http://neopallium.github.com/nixio/</a><p>[3]<a href="http://luajit.org/ext_ffi_tutorial.html" rel="nofollow">http://luajit.org/ext_ffi_tutorial.html</a><p>[4]<a href="https://github.com/justincormack/ljsyscall" rel="nofollow">https://github.com/justincormack/ljsyscall</a>
评论 #2744708 未加载
评论 #2745311 未加载
评论 #2744710 未加载
xoloxalmost 14 years ago
Hi all, author of the Lua/APR binding here. If you have any questions or comments, feel free to post them here. I haven't gotten a lot of feedback on the binding yet so would love to hear what people think about it!
评论 #2744106 未加载
tungalmost 14 years ago
The correct title for this is "Lua/APR: Apache Portable Runtime binding for Lua". I'm pointing this out because I'm tired of seeing submission titles used to make a point instead of describing what's behind the link. This mightn't be a big deal for other people, but personally, I don't like having opinions[#] forced on me like this.<p>[#] The opinion here is that Lua needs a standard library. Maybe it does, maybe it doesn't, but I want to come to that conclusion myself, that's all.
评论 #2746006 未加载
wildmXranatalmost 14 years ago
This is very nice. It's good to see examples weaved into the site on how to use it. If anything, main libapr site could use something a bit better than the Doxygen output manual as reading the unit tests from the actual source is more approachable to me than their documentation.
评论 #2743680 未加载
compayalmost 14 years ago
That's a very useful library, and also great example of how easy it is to hook into C code from Lua.<p>Another one which I prefer personally because it's more comprehensive, is Steve Donovan's Penlight. If you have a background in Python you might enjoy using it:<p><a href="https://github.com/stevedonovan/Penlight" rel="nofollow">https://github.com/stevedonovan/Penlight</a>
评论 #2744224 未加载
BasDirksalmost 14 years ago
Don't mean to hijack, but could I be referred to a good introduction to Lua? I keep hearing about it, but it's one of the few languages I know NOTHING about, and I have a free weekend!
评论 #2743694 未加载
评论 #2743693 未加载
评论 #2743686 未加载
评论 #2743670 未加载
评论 #2743929 未加载
评论 #2745141 未加载
评论 #2743769 未加载
ayalmost 14 years ago
Another interesting combination would be:<p><a href="https://github.com/justincormack/ljsyscall" rel="nofollow">https://github.com/justincormack/ljsyscall</a><p>this would work with LuaJIT: <a href="http://luajit.org/" rel="nofollow">http://luajit.org/</a><p>The FFI in LuaJIT is kind of brilliant. Check yourself.<p>EDIT: with FFI in LuaJIT you can jump very comfortably between the high-level Lua code and low-level native calls. It's almost addictive. And the code is running X times faster than the Lua baseline (X between single-digit and triple-digit values).
评论 #2745051 未加载
shubberalmost 14 years ago
I have to admit, that's kind of brilliant.