Skip to content

Instantly share code, notes, and snippets.

headchant

Block or report user

Report or block headchant

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@headchant
headchant / .lua
Last active Aug 26, 2016
LuaForkWishes
View .lua
-- Better Lua
-- my wishes for a Lua fork or patches for gamedev
-- vars are local scope by default
function defineVars()
a = 1
end
print(a) -- prints nil
-- define globals
View recursion.lua
-- recursion in lua
-- global
rec = function(i)
rec(i+1)
end
-- forward definition
local func
func = function(i)
@headchant
headchant / adlib
Created Oct 31, 2014
The Ad Lib Music Synthesizer Card, P R O G R A M M I N G G U I D E, Written by Tero Töttö
View adlib
┌──────────────────────────────────────────────────────────────────────────────┐
│ │
│ The Ad Lib Music Synthesizer Card │
│ │
│ P R O G R A M M I N G G U I D E │
│ │
│ │
│ Written by Tero Töttö │
│ │
@headchant
headchant / rltiles.lua
Last active Feb 25, 2018
roguelike ascii tile display
View rltiles.lua
local data = love.image.newImageData("Alloy_curses_12x12.png")
data:mapPixel(function(x,y,r,g,b,a)
if r == 255 and b == 255 and g ~= 255 then
r,g,b,a = 0,0,0,0
end
return r,g,b,a
end)
local img = love.graphics.newImage(data)
local spritebatch = love.graphics.newSpriteBatch(img, 87*25, "stream")
@headchant
headchant / mvm.lua
Created Apr 10, 2014
micro vm in lua
View mvm.lua
local MEM = {}
local PC = 0
local registers = {
A = 0,
B = 0,
C = 0,
D = 0
}
local fetch = function()
@headchant
headchant / deadfish.lua
Created Mar 17, 2014
deadfish intepreter
View deadfish.lua
-- deadfish interpreter
-- also accepts xkcd
local acc = 0
local commands = {
i = function() acc = acc + 1 end,
d = function() acc = acc - 1 end,
s = function() acc = acc * acc end,
o = function() print(tonumber(acc)) end,
View blink.lua
@headchant
headchant / temprec.lua
Last active Dec 25, 2015
code scetch and not very fast
View temprec.lua
--[[
Temporal Recursion in Lua
headchant 2013
follwing: http://extempore.moso.com.au/temporal_recursion.html
tested with luajit: stable 2.0.2
--]]
--[[
88 MP/H, fixed timestep
@headchant
headchant / roguelike.ps1
Last active Dec 21, 2015
a minimal roguelike base in powershell
View roguelike.ps1
Function writetext
{
Param ([int]$x, [int]$y, [string]$text)
[Console]::SetCursorPosition($x, $y)
[Console]::Write($text)
}
# set background color of the shell to black
(Get-Host).UI.RawUI.BackgroundColor = "black"
@headchant
headchant / dabblet.css
Created Jul 29, 2012
The first commented line is your dabblet’s title
View dabblet.css
/**
* The first commented line is your dabblet’s title
*/
#content{
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
font-family: 'Press Start 2P', cursive;
font-weight: 400;
You can’t perform that action at this time.