Skip to content

Instantly share code, notes, and snippets.

View thevurv's full-sized avatar
🛠️
Working on mekkanics

Vurv thevurv

🛠️
Working on mekkanics
View GitHub Profile
@thevurv
thevurv / tjson.lua
Created July 2, 2023 03:42
Tiny JSON parser in Lua.
-- JSON parser originally from qjson.lua
local function decode(json --[[@param json string]]) ---@return table
local ptr = 0
local function consume(pattern --[[@param pattern string]]) ---@return string?
local start = json:find("^%S", ptr)
if start then ptr = start end
local start, finish, match = json:find(pattern, ptr)
if start then
ptr = finish + 1
@thevurv
thevurv / luajs.lua
Last active April 9, 2025 03:33
JS-style syntax for Lua.
---@class Class
---@overload fun(t: table): Class
---@field constructor function
---@field name string
---@field prototype table<string, any>
---@class StaticField
---@field name string
---@type table<string, Class>