This file contains hidden or 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
-- 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 |
This file contains hidden or 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
-- recursion in lua | |
-- global | |
rec = function(i) | |
rec(i+1) | |
end | |
-- forward definition | |
local func | |
func = function(i) |
This file contains hidden or 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
┌──────────────────────────────────────────────────────────────────────────────┐ | |
│ │ | |
│ 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ö │ | |
│ │ |
This file contains hidden or 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 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") |
This file contains hidden or 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 MEM = {} | |
local PC = 0 | |
local registers = { | |
A = 0, | |
B = 0, | |
C = 0, | |
D = 0 | |
} | |
local fetch = function() |
This file contains hidden or 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
-- 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, |
This file contains hidden or 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 swap = function(a, b, last) | |
return (last == b) and a or b | |
end | |
local period = 0.05 | |
local blinkTimer | |
blinkTimer = function(len) | |
timer.add(period, function() | |
self.alpha = swap(0, 255, self.alpha) | |
if len > 0 then blinkTimer(len-period) else self.alpha = 255 end |
This file contains hidden or 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
--[[ | |
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 |
This file contains hidden or 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
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" |
This file contains hidden or 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
/** | |
* 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; |
NewerOlder