Skip to content

Instantly share code, notes, and snippets.

@1bardesign
1bardesign / stable_sort.lua
Last active July 7, 2022 00:03
stable sorting routines for lua
-- stable sorting routines for lua
--
-- modifies the global table namespace so you don't have
-- to re-require it everywhere.
--
-- table.stable_sort
-- a fast stable sort
-- table.unstable_sort
-- alias for the builtin unstable table.sort
-- table.insertion_sort
@randrews
randrews / hoc2.lua
Created June 3, 2015 04:45
Toy calculator in Lua, version 2
setmetatable(_ENV, { __index=lpeg })
VARS = {}
function eval(...)
local args = {...}
local accum = args[1]
for i = 2, #args, 2 do
local operator = args[i]
local num2 = args[i+1]