Skip to content

Instantly share code, notes, and snippets.

@ShannonAAEmu
ShannonAAEmu / json.lua
Created April 18, 2023 16:29 — forked from tylerneylon/json.lua
Pure Lua json library.
--[[ json.lua
A compact pure-Lua JSON library.
The main functions are: json.stringify, json.parse.
## json.stringify:
This expects the following to be true of any tables being encoded:
* They only have string or number keys. Number keys must be represented as
strings in json; this is part of the json spec.
@ShannonAAEmu
ShannonAAEmu / sha256.lua
Created January 14, 2019 20:42
This is a pure lua method for SHA256 hashing. I do not own this code, it was put here for easy access, as I can download it from here.
local MOD = 2^32
local MODM = MOD-1
local function memoize(f)
local mt = {}
local t = setmetatable({}, mt)
function mt:__index(k)
local v = f(k)
t[k] = v
return v
end