mirror of
https://github.com/TangentFoxy/etlua.git
synced 2025-07-28 02:52:17 +00:00
rename project to etlua
This commit is contained in:
14
README.md
14
README.md
@@ -1,18 +1,18 @@
|
||||
# elua
|
||||
# etlua
|
||||
|
||||
Embedded Lua templating
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
$ luarocks install --server=http://rocks.moonscript.org elua
|
||||
$ luarocks install --server=http://rocks.moonscript.org etlua
|
||||
```
|
||||
|
||||
## Tutorial
|
||||
|
||||
```lua
|
||||
local elua = require "elua"
|
||||
local template = elua.compile([[
|
||||
local etlua = require "etlua"
|
||||
local template = etlua.compile([[
|
||||
Hello <%= name %>,
|
||||
Here are your items:
|
||||
<% for i, item in pairs(items) do %>
|
||||
@@ -41,19 +41,19 @@ following newline if there is one, for example: `<%= 'hello' -%>`.
|
||||
The module can be loaded by doing:
|
||||
|
||||
```lua
|
||||
local elua = require "elua"
|
||||
local etlua = require "etlua"
|
||||
```
|
||||
|
||||
### Methods
|
||||
|
||||
#### `func = elua.compile(template_string)`
|
||||
#### `func = etlua.compile(template_string)`
|
||||
|
||||
Compiles the template into a function, the returned function can be called to
|
||||
render the template. The function takes one argument: a table to use as the
|
||||
environment within the template. `_G` is used to look up a variable if it can't
|
||||
be found in the environment.
|
||||
|
||||
#### `result = elua.render(template_string, env)`
|
||||
#### `result = etlua.render(template_string, env)`
|
||||
|
||||
Compiles and renders the template in a single call. If you are concerned about
|
||||
high performance this should be avoided in favor of `compile` if it's possible
|
||||
|
Reference in New Issue
Block a user