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 November 14, 2024 15:36
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