Skip to content

Instantly share code, notes, and snippets.

@SuperSpaceEye
SuperSpaceEye / lua_pid.lua
Created May 4, 2023 20:03
Translated python pid to lua
---
--- Original source code: https://github.com/m-lundberg/simple-pid/tree/master
--- Translated to lua: SpaceEye
---
local function _clamp(value, limits)
limits = limits or {}
local lower, upper = limits[1], limits[2]
if value == nil then
return nil
@SuperSpaceEye
SuperSpaceEye / ballistic_calculator.lua
Last active March 6, 2024 16:49
Brute-force ballistic calculator
---
--- Original creator of formulas: @sashafiesta on Discord
--- Original creator of python adaptation: @malexy on Discord
--- Optimized and translated python code to lua: SpaceEye. (https://gist.github.com/SuperSpaceEye/c33443213605d1bf35f81737c9058dc2)
--- Some lua optimizations: Autist69420
---
-- Simple micro-optimizations for better performance
local table_insert = table.insert
local rad, sin, cos, log, abs, min, pow = math.rad, math.sin, math.cos, math.log, math.abs, math.min, math.pow