Skip to content

Instantly share code, notes, and snippets.

View hoelzro's full-sized avatar

Rob Hoelz hoelzro

View GitHub Profile
module('mybot.wikipedia')
command = 'wiki'
local function get_mw_results(url, query)
-- do something
end
function handlemessage(msg)
local body = msg.body
local names = {'wikipedia'}
plugins = {}
for _, plugin_name in ipairs(names) do
local plugin_env = setmetatable({}, { __index = getfenv(0), __metatable = {} })
local plugin_chunk = loadfile(plugin_name .. '.lua')
setfenv(plugin_chunk, plugin_env)
pcall(plugin_chunk)
local t =setmetatable({}, {__call = function(s)
return next, s
end})
t.foo = 1
t.bar = 2
t.baz = 3
for k in t() do
print(k)
local t = setmetatable({}, {__call = function(self, state, k)
return next(self, k)
end})
t.foo = 1
t.bar = 2
t.baz = 3
for k, v in t do
print(k, v)
pegasus:cpan-api rob$ git submodule update
fatal: reference is not a tree: d334fdfedf99f806923dc40d98151d817de3dd51
Unable to checkout 'd334fdfedf99f806923dc40d98151d817de3dd51' in submodule path 'inc/monken/p5-elasticsearch-model'
fatal: reference is not a tree: d334fdfedf99f806923dc40d98151d817de3dd51
Unable to checkout 'd334fdfedf99f806923dc40d98151d817de3dd51' in submodule path 'inc/monken/p5-elasticsearch-model'
local pluto = require 'pluto'
local limit = arg[1]
if not limit then
limit = 1
end
t = {}
for i=1,limit do
t = { t }
use strict;
use warnings;
use Test::More tests => 1;
use Plack::Test;
$Plack::Test::Impl = 'AnyEvent';
test_psgi $app, sub {
my ( $cb ) = @_;
use strict;
use warnings;
use HTTP::Request::Common;
use Test::More tests => 36;
use Test::More;
use Plack::Test;
my $simple_app = sub {
my ( $env ) = @_;
#! /usr/bin/env lua
require 'lgob.loader'
package.loadlib('lgob.webkit', 'luaopen_lgob_webkit')