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 debug = require 'debug' | |
-- from.lua | |
-- supports some useful shortcuts when creating locals from tables or modules | |
-- require 'from' | |
-- local sin,cos,tan = slots(3) from(math) | |
-- local import,printf = slots(2) from 'pl.utils' | |
-- local pretty,utils,xml = slots(3) from 'pl.*' | |
-- | |
-- Uses the debug library, so it's not very fast - only use for top-level initialization! |
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]) | |
--]] |
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
-- 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
import insert,concat,remove from table | |
class List | |
new: (t) => | |
@ls = t or {} | |
add: (item) => | |
insert @ls,item |
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
require 'pl' | |
class.Array(List) | |
function Array.__add (a1,a2) | |
return a1:map2('+',a2) | |
end | |
function Array.__sub (a1,a2) | |
return a1:map2('-',a2) |
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 packages = { | |
bit="liblua5.1-bitop0", -- -- fast bit manipulation library for the Lua language v | |
cgilua="liblua5.1-cgi0", -- -- CGI library for the Lua language version 5.1 | |
sapi="liblua5.1-cgi0", -- -- CGI library for the Lua language version 5.1 | |
copas="liblua5.1-copas0", -- -- Copas is a dispatcher of concurrent TCP/IP requests | |
cosmo="liblua5.1-cosmo0", -- -- A template library for the Lua langua version 5.1 | |
coxpcall="liblua5.1-coxpcall0", -- -- Protected function calls across coroutines for Lua 5 | |
curl="liblua5.1-curl0", -- -- libcURL bindings for the Lua language version 5.1 | |
luaevent="liblua5.1-event0", -- -- asynchronous event notification library for Lua vers | |
lxp="liblua5.1-expat0", -- -- libexpat bindings for the Lua language version 5.1 |
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<script src="/flot/jquery.min.js" type="text/javascript"></script> | |
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="/media/flot/excanvas.min.js"></script><![endif]--> | |
<script language="javascript" type="text/javascript" src="/flot/jquery.flot.min.js"></script> | |
<script language="javascript" type="text/javascript" src="/flot/jquery.flot.navigate.js"></script> | |
<style type="text/css"> | |
.center { text-align:center; } |
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
-- struct.lua | |
--- defining a struct constructor --- | |
local function ordered_map (t) | |
local fields,keys = {},{} | |
for i,item in ipairs(t) do | |
local key,value = next(item) | |
fields[key] = value | |
keys[i] = key | |
end |
OlderNewer