Skip to content

Instantly share code, notes, and snippets.

View josefnpat's full-sized avatar
what

Seppi josefnpat

what
View GitHub Profile
@josefnpat
josefnpat / oop.lua
Last active June 1, 2017 15:57
Lua 5.1 OOP Inheritance example
-- @josefnpat's Lua OOP example
-- Example of base class
local vehicleclass = {
-- Example of class variable
_defaultColor = "blue"
}
function vehicleclass.new(init)
@josefnpat
josefnpat / Makefile
Last active July 5, 2020 08:19
Love Makefile of Doom
# Copyright 2017 Josef N Patoprsty
#
# 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:
#
# The above copyright notice and this permission notice shall be included in all
@josefnpat
josefnpat / pico8_skip_0.1.6_linux32.bsdiff
Last active August 30, 2020 06:24
Pico8 0.1.6 Intro Skip for linux 64
@josefnpat
josefnpat / run.sh
Created June 4, 2016 13:02
Itch.io App Sample Linux Integration (with love binary dependency)
#!/bin/sh
# Copyright (c) 2014 Josef Patorpsty
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
@josefnpat
josefnpat / .gitignore
Last active December 8, 2015 06:37
Laptop Info
*.swp
@josefnpat
josefnpat / class.lua
Last active November 14, 2015 14:17
Class concept for lua 5.1
-- implementation
function class(i)
local c = {fields={},field_types={}}
assert(type(i)=="table","class expects a table input.")
for type_name,default_value in pairs(i) do
local t,n = nil,nil
string.gsub(
type_name,
"(%l*)(%l*)",
@josefnpat
josefnpat / SourceFromTone.lua
Last active November 5, 2015 19:49
SourceFromTone function from kyle__
function SourceFromTone(tone_in_hz)
local rate = 44100
local samples = math.floor((rate / tone_in_hz) + 0.5)
tone_in_hz = rate / samples
local data = love.sound.newSoundData(samples, rate)
--print(samples, rate, tone_in_hz)
for i = 0, samples do
local value = (i * math.pi * tone_in_hz) / (rate / 2)
--print(value, math.sin(value))
@josefnpat
josefnpat / conf.lua
Last active October 31, 2015 17:46
Simple screen brightness app that leverages xbacklight
function love.conf(t)
t.version = "0.9.2"
t.window.title = "Screen Brightness"
t.window.width = 400
t.window.height = 32
end
@josefnpat
josefnpat / .gitignore
Last active October 20, 2015 17:41
MLGUI - Minimal Love Graphical User Interface
*.swp
@josefnpat
josefnpat / readme.md
Last active April 7, 2024 11:39
Going from Lua 5.2 to PICO-8's Lua

This information applies to the PICO-8 0.1.6 release.

This document is here to help folks with a proficiency in Lua understand the limitations and discrepencies between Lua and PICO-8's Lua.

You can always view the manual or yellowafterlife's extended 0.1.1 manual.

General

  • anything written in uppercase the PICO-8 editor or .p8 is made lowercase by the editor. → editing the .p8 file directly can work
  • print(function() end) outputs the string function instead of the string function: 0x0000000.