This file contains hidden or 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
| for _,s in ipairs{"AZ","09","!!","??","::","..","--"} do | |
| local b1=string.byte(s:sub(1,1)) | |
| local b2=string.byte(s:sub(2,2)) | |
| for i=b1, b2 do | |
| print(string.format([[ | |
| [%q]={ | |
| {}, | |
| },]],string.char(i))) | |
| end | |
| end |
This file contains hidden or 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
| do | |
| local dox, doy | |
| local function drag(x, y) | |
| end | |
| local function grab(x, y) | |
| dox, doy = x, y | |
| drag(x, y) | |
| end | |
| local function release(x, y) | |
| dox, doy = nil, nil |
This file contains hidden or 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
| --has the same signature as classic module (almost) | |
| local function module(name, encenv) | |
| local mod_t = {} | |
| local envmt = {} | |
| function envmt.__index(t, k) | |
| return mod_t[k] or encenv[k] | |
| end | |
| function envmt.__newindex(t, k, v) | |
| mod_t[k] = v |
This file contains hidden or 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
| --takes the environment to encapsulate | |
| local function modme(encenv) | |
| local retmod = {} | |
| local envmt = {} | |
| function envmt.__index(t, k) | |
| return retmod[k] or encenv[k] | |
| end | |
| function envmt.__newindex(t, k, v) | |
| retmod[k] = v | |
| end |
This file contains hidden or 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 iup = require "iuplua" | |
| local cairo = require "lcairo" | |
| local drawf, errmsg | |
| local function showerr(hdc, err) | |
| uhoh = cairo.CreateContext(hdc) | |
| cairo.set_source_rgb(uhoh,1,0,0) | |
| cairo.select_font_face (uhoh,"Consolas", | |
| cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_BOLD) |
This file contains hidden or 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
| # the full list is at http://www.scintilla.org/SciTEDoc.html # | |
| #settings provided in Lua for Windows' SciTEGlobal.properties | |
| import minilfw | |
| #font change | |
| font.base=font:Consolas,size:8 | |
| font.small=$(font.base) | |
| font.comment=$(font.base) | |
| font.code.comment.box=$(font.comment) |
This file contains hidden or 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
| #! /home/stuserbot/bin/lua | |
| local rt = {} | |
| local getenv = os.getenv | |
| local strupper = string.upper | |
| local strlower = string.lower | |
| local format = string.format | |
| local gsub = string.gsub | |
| local setmetatable = setmetatable | |
| local write = io.write |
This file contains hidden or 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
| return function (t,o) | |
| local refs = {} | |
| local rk, rv | |
| if type(o.recurse) == "string" then | |
| if string.find(o.recurse,'k') then | |
| rk = true end | |
| if string.find(o.recurse,'v') then | |
| rv = true end | |
| elseif o.recurse then | |
| rk=true; rv=true |
This file contains hidden or 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 fp = require "fancyparams" | |
| myfunction = fp( | |
| {{"a"},{"b",7},{"c",5}}, | |
| function(a, b, c) | |
| print(a, b, c) | |
| end | |
| ) |
This file contains hidden or 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 src = http.request"http://tools.ietf.org/id/draft-ietf-ldapext-ldap-c-api-05.txt" | |
| src = string.gsub(src,[[ | |
| Expires: May 2001 -%[Page %d+%] | |
| C LDAP API -C LDAP Application Program Interface -17 November 2000]],"\n") | |
| local function count(pat) | |
| return select(2,string.gsub(src,pat,"")) | |
| end | |
| local function plain(str) |