Skip to content

Instantly share code, notes, and snippets.

-- [[
-- # Free-to-use License
-- Copyright (c) 2024 Salem Raddaoui
-- Creation Date: December 10, 2024, 9:21 AM
-- 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:
-- 1. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
local matrix4, vector2, vector3, vector4
matrix4 = {
__type = "matrix4",
__call = function(_, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, m16)
return setmetatable({
__type = "matrix4",
m01 = m1 or 0, m02 = m2 or 0, m03 = m3 or 0, m04 = m4 or 0,
m05 = m5 or 0, m06 = m6 or 0, m07 = m7 or 0, m08 = m8 or 0,
m09 = m9 or 0, m10 = m10 or 0, m11 = m11 or 0, m12 = m12 or 0,
function newFile(filename, content)
-- Open the file in write mode, create if it doesn't exist, clear existing content
-- Extract directory path from filename
local directoryPath, fileName = filename:match("(.-)([^\\/]-%.?([^%.\\/]*))$")
-- Create directory if it doesn't exist
if directoryPath ~= "" and not love.filesystem.getInfo(directoryPath) then
local success, errorMsg = os.execute("mkdir \"" .. directoryPath .. "\"")
if not success then