Skip to content

Instantly share code, notes, and snippets.

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