https://github.com/gamesys/moonshine/
- Weak tables?
- non-string keys?
- ES6 maps?
- issues with 'hasOwnProperty'?
var lines = { | |
B: 'Bakerloo', | |
C: 'Central', | |
D: 'District', | |
H: 'Hammersmith & Circle', | |
J: 'Jubilee', | |
M: 'Metropolitan', | |
N: 'Northern', | |
P: 'Piccadilly', |
function instanceOf (subject, super) | |
super = tostring(super) | |
local mt = getmetatable(subject) | |
while true do | |
if mt == nil then return false end | |
if tostring(mt) == super then return true end | |
mt = getmetatable(mt) |
function base64Encode (data) { | |
var encoded = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', | |
chars, bin, | |
output = '', | |
i; | |
while (data) { | |
chars = data.substr (0, 3) + String.fromCharCode (0, 0); | |
bin = ''; |
[ | |
{ | |
"driverNumber":5, | |
"name":"J. BUTTON", | |
"team":"Vodafone McLaren Mercedes", | |
"lap":4, | |
"stop":1, | |
"duration":22282 | |
}, | |
{ |
[ | |
[ | |
{ | |
"driverNumber":1, | |
"duration":99646 | |
}, | |
{ | |
"driverNumber":4, | |
"duration":101714 | |
}, |
[ | |
{ | |
"driverNumber":7, | |
"tyres":[ | |
"supersoft", | |
"medium", | |
"medium" | |
] | |
}, | |
{ |
[[{"driverNumber":1,"duration":121790},{"driverNumber":3,"duration":125239},{"driverNumber":2,"duration":125298},{"driverNumber":10,"duration":125768},{"driverNumber":5,"duration":127046},{"driverNumber":4,"duration":127716},{"driverNumber":9,"duration":127937},{"driverNumber":6,"duration":128740},{"driverNumber":15,"duration":129128},{"driverNumber":11,"duration":129804},{"driverNumber":19,"duration":130567},{"driverNumber":7,"duration":131135},{"driverNumber":8,"duration":131346},{"driverNumber":14,"duration":131810},{"driverNumber":16,"duration":132738},{"driverNumber":12,"duration":133007},{"driverNumber":20,"duration":133869},{"driverNumber":18,"duration":134774},{"driverNumber":21,"duration":134824},{"driverNumber":22,"duration":135978},{"driverNumber":23,"duration":136626},{"driverNumber":17,"duration":137676}],[{"driverNumber":1,"duration":117127},{"driverNumber":2,"duration":116963},{"driverNumber":10,"duration":117795},{"driverNumber":5,"duration":119307},{"driverNumber":9,"duration":118701},{"drive |
https://github.com/gamesys/moonshine/
This is a Lua port of of jbroadway's PHP project of the same name.
A very basic pattern-based Markdown parser. Supports the
following elements (and can be extended via slimdown.addRule()
):
This is a little experiment and my first Lua project aimed at performance in LuaJIT.
Most of the code is bootstrap, but at the bottom you'll find some tests followed by some benchmarking code.
I'm surprised to find that the benchmarking code runs 4x faster with the tests included than when they're removed. In fact, just removing the print() statement at the end of the tests makes the benchmark run a lot slower. Why is this?
(Unfortunately, I haven't been able to reduce the code sample and still maintain the same behaviour.)