This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
A Lua module that defines a little DSL for generating CSS | |
-- csstest.lua | |
require 'css' | |
width = 500 | |
lmargin = 50 | |
leftm = 150 | |
gap = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- translate Markdown with code blocks into HTML | |
-- with syntax highlighting. | |
-- If article.md was the source, Lua was the language and we | |
-- wanted a preview: | |
-- lua prettify.lua article lua preview | |
-- Without the last argument it will just write out the HTML body. | |
-- Languages supported are 'lua', 'cpp', 'java' and 'go | |
-- Indented code blocks may begin with an explicit @lang name line; | |
-- if you do this then mark every code block explicitly | |
-- e.g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- makes interactive prompt dodgy. | |
-- (In an ideal world, should be able to switch this off only for | |
-- the message buffer) | |
_m.textadept.editing.AUTOPAIR = false | |
-- useful function which can safely handle argument lists containing nil; | |
-- the resulting table has n set to the real length. | |
local function pack (...) | |
local args = {...} | |
args.n = select('#',...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function out_of_range(i,n) | |
if type(i) == 'number' then | |
if i > 0 and i <= n then return true | |
else error('out of range',3) | |
end | |
else | |
error 'cannot index array by non-number type' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ Example: | |
sa = StringAccessor 'hello' | |
for c in sa:iter() do | |
print(c) | |
end | |
print(sa[1],sa[3]) | |
print('end',sa[-1]) | |
--]] |
NewerOlder