Peter Odding |
|
|
Been using Lua for about a year now. Loving it so far! I can be found @ xolox.ath.cx |
|
Hi there! I'm Peter Odding and I'm currently studying for my bachelor's degree in computer science. I've been using Lua for several years now and in that time Lua has become my favorite programming language. For more information about me you can visit [my homepage]. |
|
Thanks to both the lua authors and community for a great programming environment! |
|
Here is the Lua (related) code I've published online in one form or another: |
|
=== Apache Portable Runtime === There seem to be several initiatives to provide a more comprehensive c-side library to Lua. See for example: |
|
* LuaApr - A binding to the Apache Portable Runtime library ([homepage]) * [LXSH]: Lexing & Syntax Highlighting in Lua (powered by LuaPeg) * [Semantic highlighting for Lua in Vim] (powered by LuaInspect) * [Vim file type plug-in] for editing Lua source code * [Straight forward implementation] of the [Levenshtein distance] * The page LpegRecipes contains a Lua lexer written using LuaPeg * Several short snippets on [snippets.luacode.org]: * [Lua script for finding the right date formats] * [Weighted random choice] * [String splitting] * [Version sort] |
|
* ExtendedApi * ExtensionProposal * StandardLibraries One of the possible *existing* libraries to interface would be http://apr.apache.org/. I thought I'd see just how difficult that was. A year ago. Never even got it to build. Let alone interface it with Lua :). Last month I tried again, got APR and APR-util to build, interfaced a few functions, and it all worked! With a platform not even supported according to their docs: Visual C++ Express '05. Still haven't managed to build it with MinGW though, which is my favorite on Windows. I have no idea how much I'll be able to interface, and how soon I get tired of it, and of how much value the source code is. Right now I'm trying to stay close to the APR docs regarding function names and and parameters. Here's what I currently have:
It will take some time to get things cleaned up, before I release sources and binaries. If you want to play around with it before then, mailto:xolox@home.nl. |
|
Thanks to both the Lua authors and community for a great programming environment! |
|
=== Random Lua sourcecode ===
----
This may do, though a less hack-ish approach is available in LuaFileSystem -- http://www.keplerproject.org/luafilesystem/manual.html .-- DavidManura A c library would indeed be preferable. However my point was to show Lua's flexibility even without extension libraries. ----
Why not just this?
An alternate approach, instead of wrapping require, is to move this code into the module itself, as done in "Pattern: Modules a la Perl" in LuaDesignPatterns. This alternate approach has the disadvantage that you can't immediately use it on existing modules that don't follow this pattern. --DavidManuraWhy not just this? More of a safeguard than necessity. I vaguely remember coming across modules that return true and load themselves in a global. From my understanding of the manual, this true would then be stored in package.loaded[modname] and returned upon another require() call with the same modname. Right? The sequence _G[modname] or require(modname) and _G[modname] would catch this. But then that completely discards require()'s return value... Right, I see your point :) |
Here is the Lua (related) code I've published online in one form or another:
Thanks to both the Lua authors and community for a great programming environment!
Some e-mails on the mailing list contain non-wrapping text, which really annoys me, because I don't like horizontal scrolling. So I wrote a user-stylesheet that forces text wrapping. Then I decided to change the color-scheme for syntax-highlighted lua code to Vim's slate theme. While I was playing around with Firefox I decided to add the mailing list and wiki searches to Firefox's searchbox. The resulting files, which contain instructions on installation, are:
This is what the syntax highlighting looks like (the font is Consolas, one of MS Vista's new fonts):