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
if data then | |
local where = {} | |
local k, v = next(data, nil) | |
if k then | |
insert(where, concat{k, '=', sql_tostring(v)}) | |
for k, v in next, data, k do | |
insert(where, concat{' AND ', k, '=', sql_tostring(v)}) | |
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
local loco = require "loco" | |
local gen = loco.new() | |
gen:feed("init.lua") | |
gen:write("gh-pages") |
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
Command "cmd" | |
{ | |
function(...) | |
local args = {...} | |
for k, arg in pairs(args) do | |
reply("Arg #%d: %s", k, arg) | |
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
Command "imdb" | |
{ | |
expectedArgs = "^%s*(.-)%s*$"; | |
function(search) | |
search = search:gsub("[^%w ]", "") | |
reply("search: %s", search) | |
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 pairs = pairs | |
local type = type | |
local tostring = tostring | |
local print = print | |
local table = table | |
local next = next | |
module "tableprint" | |
local function tableprint(t, tab, sink, cache) |
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 not put entries into the channels table! | |
--replace with your account password | |
local authpass = "YOURPASSWORD" | |
--gamesurge auth | |
function on_connect(bot) | |
bot:sendChat("[email protected]", "IDENTIFY " .. authpass) | |
bot:setMode{add = "x"} -- for mask | |
bot:hook("OnNotice", "auth", function(user, channel, message) |
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
--Say "Hi!", wait 3 seconds, say "I'm a bot!", wait 10 seconds, repeat | |
do | |
local spamchannel | |
--Think hooks are run once every bot:think(), but can be delayed with the "wait" function. | |
--The "wait" function does not block the rest of the program. | |
Hook "Think" | |
{ | |
enabled = false; --not enabled by default |
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
template Range(int from, int to) if(from < to) | |
{ | |
alias RangeImpl!(from, to - 1) Range; | |
} | |
template RangeImpl(int lowerLimit, int iterator, tail...) | |
{ | |
static if(iterator < lowerLimit) | |
alias tail RangeImpl; | |
else |
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
import std.traits; | |
// Simplified version; does not work with a large number of possible types for F | |
private extern(C++) interface Thiscall(F) | |
{ | |
ReturnType!F cppfunc(ParameterTypeTuple!F args); | |
} | |
auto thiscall(F, Args...)(void* _this, F func, Args args) | |
{ |
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
// Example options | |
struct CmdOptions | |
{ | |
/// Print information during execution. | |
bool verbose = false; | |
/// Output name. | |
string outputname = "foo"; | |
} |
OlderNewer