An assortment of obfuscated Mandelbrot implementations in Lua. Originally started by me, optimized further by Zevv.
If you're reading this document, you're probably one of many people confused about how to implement OOP-like classes in Lua. But no worries! This document aims to explain all the fundamental concepts in beginner-friendly language.
Before we start, we need to talk about metatables. These are Lua's way of allowing users to overload operators. Operators include
arithmetic +
, -
, *
, /
, etc., but also things like indexing tables a[b]
, creating new indices in tables a[b] = c
, function
calls, a(b, c, d)
, you get the idea.
We can set the metatable of a table using setmetatable(t, metatable)
. The metatable
is another table, that contains fields for overriding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- MIT License | |
-- | |
-- Copyright (c) 2021 liquidev | |
-- | |
-- Permission is hereby granted, free of charge, to any person obtaining a copy | |
-- of this software and associated documentation files (the "Software"), to deal | |
-- in the Software without restriction, including without limitation the rights | |
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
-- copies of the Software, and to permit persons to whom the Software is | |
-- furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local syntax = require "core.syntax" | |
local patterns = {} | |
local symbols = { | |
["nil"] = "literal", | |
["true"] = "literal", | |
["false"] = "literal", | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <alsa/asoundlib.h> | |
#include <math.h> | |
#include <unistd.h> | |
#include <xdo.h> | |
#define LOG(...) do { \ | |
fprintf(stderr, __VA_ARGS__); \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <alsa/asoundlib.h> | |
#define LOG(...) do { \ | |
fprintf(stderr, __VA_ARGS__); \ | |
fflush(stderr); \ | |
} while (0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import os | |
import parseopt | |
import random | |
import strutils | |
import rapid/gfx | |
import rapid/res/textures | |
import rapid/res/images | |
import rapid/gfx/fxsurface |
- WM: i3-gaps
- Wallpaper
- Font
- Compositor: compton-tryone
- Bar: polybar
- Terminal: alacritty
- rofi: default, looks good enough but I might customize at some point
Config files and scripts below.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## An SDL2 wrapper using nimterop. | |
import os | |
import nimterop/build | |
import nimterop/cimport | |
const | |
Base = getProjectCacheDir("sdl2") |
NewerOlder