Login
or
register
Start
Introduction
Features
Demos
Why Lua?
What is Kepler?
Sightings
License
Sandbox
Whodunit?
Install
Installation
Basic Configuration
Custom Installation
Deployment
Troubleshooting
Problems
Tweak
Configuration
More Parameters
Permissions
Styles
Templates
I18n
Plugins
Storage
Markup
Authentication
Spam
Track
News
Releases
Project Planning
Recent Wiki Edits
Edits by Recent Users
Talk
Mailing List(s)
This Wiki
Report a Bug
Grok
Basic Concepts
Saci
Versium
Actions
WSAPI
LuaRocks
Hack
Source
Rocks
Architecture
Guided Tour
"Earth"
Coding Standard
Tasks
Why Lua?
Anonymous users must enter
captcha
below.
Don't put anything here
Page Parameters
Page Name (for URL)
Page Title
Show Advanced Options
Category
Prototype
Don't put anything here
Don't put anything here
Page Content
Don't put anything here
Don't put anything here
<span class="teaser"> Lua is mostly often praised for its performance and the ease with which it integrates with C. It has other strengths, however. One that [[Sputnik]] exploits most aggressively is Lua's ability to serve at the same time as a programming language and a format for data storage. </span> When working with other programming languages, one typically separates the logic (written in, say, Java) and the data (stored as, say, XML or database tables). One reason for this is that Java source would not work well as a format for data, while XML doesn't work for expressing the logic. When using Lua, however, one can write the logic in Lua, and store the data in Lua too. Sputnik uses this extensively, storing almost everything it needs to store in Lua itself. All pages are stored as Lua files; for example, this page is internally represented <a href="http://sputnik.freewisdom.org/en/Lua.raw">this way</a>. Many pages also contain Lua code, for instance [[_navigation]]. Lua provides an easy way to quickly and securely load such Lua code from inside Lua, making it easy, for example, to parse a string into a "table", check a field in it (or run a function that it defines), and then perhaps, take one of its fields and parse _that_ as Lua code. More generally, Lua is a very permissive language, even more so than Python. This comes in handy when working with heterogeneous data. Writing a wiki with a framework that uses a relational database underneath, one would have to think ahead of time what fields each "page" should have, and adding fields (or even changing their size) could be quite a hassle. With Sputnik, it's a matter of inserting the new field into the pages that need it. Checking if a "page" has a particular attribute is as easy as asking for its value. If it's not there, you just get "nil" back. **Full disclosure** What's presented above is, as you might have guessed, an _ex post_ account of why Lua has turned out to be a good language to write a wiki in and why you might want to consider Lua for a future project. It's not, however, the reason why Sputnik was written in Lua in the first place. I ([Yuri](http://takhteyev.org)) wrote the first version of Sputnik mostly in order to learn Lua, though the actual story is a bit stranger, and you should read [[Background]] if you want the details.
About this Edit
Don't put anything here
Minor Edit
Edit Summary
Powered by
Sputnik
|
XHTML 1.1