Login
or
register
Overview
Overview
Why Lua?
Vision
General FAQ
Credits
Getting Started
Installation
Hello World
Web Servers
Getting Help
Status
News
Releases
Community
Overview
Dev Team
Mailing List
Orbit
Anonymous users must enter
captcha
below.
Don't put anything here
Page Parameters
Page Name (for URL)
Don't put anything here
Page Title
Don't put anything here
Show Advanced Options
Category
Prototype
Don't put anything here
Page Content
## Overview More complete docs will be at [Orbit's LF page](http://orbit.luaforge.net) shortly. If you are itching to try it add [this repository](http://www.lua.inf.puc-rio.br/~mascarenhas/rocks) to your [LuaRocks](http://luarocks.org) config and then do `luarocks install orbit`. You can find samples in Orbit's directory inside your local LuaRocks repository. Some samples need LuaSQL, do `luarocks install luasql-sqlite3` to be able to run them. Orbit is an MVC web framework for Lua. The design is inspired by lightweight frameworks such as [Camping](http://code.whytheluckystiff.net/camping/) and [web.py](http://webpy.org). It completely abandons the current CGILua model of "scripts" in favor of applications. Each Orbit application can fit in a single file, but you can split it into multiple files if you want. All Orbit applications follow the [[WSAPI]] protocol, so currently work with Xavante, CGI and Fastcgi. It includes a launcher that makes it easy to launch a Xavante instance for development, and are easily launched from CGI and Fastcgi-enabled webservers using the generic WSAPI launchers. ## Simple app Below is a very simple Orbit application: <pre> #!/usr/bin/env wsapi local orbit = require"orbit" local cosmo = require"template.cosmo" local songs = orbit.new() function songs.index(web) local songlist = { "Sgt. Pepper's Lonely Hearts Club Band", "With a Little Help from My Friends", "Lucy in the Sky with Diamonds", "Getting Better", "Fixing a Hole", "She's Leaving Home", "Being for the Benefit of Mr. Kite!", "Within You Without You", "When I'm Sixty-Four", "Lovely Rita", "Good Morning Good Morning", "Sgt. Pepper's Lonely Hearts Club Band (Reprise)", "A Day in the Life" } return songs.layout(songs.render_index({ songs = songlist })) end songs:dispatch_get(songs.index, "/") function songs.layout(inner_html) return html{ head{ title"Song List" }, body{ inner_html } } end orbit.htmlify(songs, "layout") songs.render_index = cosmo.compile([[ <h1>Songs</h1> <table> $songs[=[<tr><td>$it</td></tr>]=] </table> ]]) return songs.run </pre> The example uses Orbit's built-in html generation (`orbit.htmlify`), but you are free to use any method of generating HTML that you want, such as the [Cosmo](http://www.freewisdom.org/projects/sputnik/Cosmo) template library, for instance. Run this either with the orbit dev. server (`orbit songs.lua`) or through CGI or FastCGI. ## OR Mapping Orbit also includes a basic OR mapper that currently works with [LuaSQL's](http://luaforge.net/projects/luasql) SQLite3 and MySQL drivers (with the HEAD of LuaSQL!). The mapper provides dynamic search methods, a la Rails' ActiveRecord (find\_by\_field1\_and\_field2{val1, val2}), as well as templates for conditions (find_by("field1 = ? or field1 = ?", { val1, val2 })). The sample applications use this mapper. A nice side-effect of the Orbit application model is that we get an "application console" for free. For example, with the blog example we can add a new post like this: <pre> $ lua51 -i blog.lua > p = blog.posts:new() > p.title = "New Post" > p.body = "This is a new blog post. Include *Markdown* markup freely." > p.published_at = os.time() > p:save() </pre> You can also update or delete any of the model items right from your console, just fetch them from the database, change what you want and call `save()` (or `delete()` if you want to remove it). ## Docs and download There's not much documentation right now, apart from the source code and sample applications. See the start of this page on instructions for installing via LuaRocks (the preferred method). Even if you do not have LuaRocks the rockspec file tells what dependencies you need to fetch. ## Orbit powered sites * [Lablua](http://www.lua.inf.puc-rio.br) - Using the CMS sample app, Apache 2 as front-end, proxying to a Xavante server, all running on a Linksys NSLU2
About this Edit
Minor Edit
Don't put anything here
Edit Summary
Don't put anything here
Powered by
Sputnik
|
XHTML 1.1