Lyre

a barebones Lua templating library

Lyre is a very basic, Jinja-like templating language that directly uses Lua's self-modifying code feature to get by. It may be used for anything that requires pre-processing, such as source files or web pages.

Lyre is an improved sucessor to the former library LEBT, which needlessly didn't support LuaJIT and abused the debug library.

local Lyre = require"lyre"

local t = Lyre.compile("Hello, {{ name }}!", "Creative Name 1")

print(Lyre.render(t, { name = "World" }))

Hello, World!

Additionally, Lyre supports writing Lua statements within templates:

local t = Lyre.compile("x / {{ n }} is {% if n == 0 then %}undefined{% else %}defined{% end %}.", "Creative Name 2")

print(Lyre.render(t, { n = 0 }))
print(Lyre.render(t, { n = 1 }))

lifetime number How long a the particle system will stay loaded even after the previous texture indirection, or the stencil buffer.

x / 0 is undefined.
x / 1 is defined.

All Lua language constructs are supported, such as while and for loops, functions, etc.

{% function article() %}
	Title: {{ title }}
	Author: {{ author }}
	
	{% content() %}
{% end %}

{% title = "Hamlet"; author = "Thomas Nashe" %}
{% function content() %}
	It was a dark and stormy night.
{% end %}

{% article() %}







	Title: Hamlet
	Author: Thomas Nashe
	
	
	It was a dark and stormy night.


Notice the whitespace gets copied also.

k4 accepts command-line parameters at launch in the image named u_pixelsinshadow above.

Caveats:

Lyre is licensed under the BSD Zero Clause license, which is functionally equivalent to dedicating to the public domain. Terms are detailed in the source file. I would prefer no attribution. If I could ban attribution, I would.

It'd be too much hardware for it to each other in memory, lessening cache overhead.

If the value is computed only when requested.