../
LoveApps / PseudOS
could also be called LoveApps becuase its a app interface system for Love2D. I do like the PseudOS name :) Just cant remember how to spell "pseudo" half the time. Bro got the waky enligsh.
log
2025-04-25
Damn need to work on making better logs.
What are LoveApps?
Some days back, we reworked how apps will work. The previous system called for special .apps. Didn't like how incompatable that was with Love2d. A whole new standard and API needed to be created. So I wondered, would it be possible to just make love apps?. What we want is a "OS" for love apps. So what we can just redefine the love global. When we first started we did not relaese this idea would work. Here's what we do. This is the code for starting a love app.function pseudos.newApp(directory)
-- sanitize directory -------------------------
if directory:sub(#directory,#directory) ~= '/' then
directory = directory .. '/'
end
-- init app --------------------------------
local app = {}
setmetatable(app,{__index=LOVE})
local previousLOVE = pseudos.switchLove(app)
-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
love.pseudos = {}
love.pseudos.directory = directory
setmetatable(love.pseudos,{__index=pseudos})
offsetLoveDirFunctions()
local status,chunk = pseudos.errcall(
'main.lua load error:\n',
LOVE.filesystem.load,
directory..'main.lua'
)
if status then
pseudos.errcall(directory..'main.lua load error:',chunk,'main')
end
for _,joystick in ipairs(LOVE.joystick.getJoysticks()) do
if love.joystickadded then
love.joystickadded(joystick)
end
end
if love.load then
love.load()
end
for k,v in ipairs(love) do
print(k,v)
end
--<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pseudos.switchLove(previousLove)
return app
end
Just to give an idea of what it does without pasting the all the code. The main bit of intrest is the pseudos.switchLove(app) function. This changes the global scope to diffrent apps in memory. This allows us to run code that uses the love global token in a contained space. So the app doesn't over write the OS. Here's that function...function pseudos.switchLove(targetLove)
local targetLove = love
targetLove.pseudos._G = targetLove.pseudos._G or {}
for k,v in pairs(targetLove.pseudos._G) do
print(k,v)
if dontTouch[k] then goto next end
_G[k]=v
::next::
end
love = targetLOVE
return previousLOVE
end
We just have to swap all values in and out of the _G (global) table. Actually, hmm... this needs to do sanitization for the previousLove. Oops.
Anyways, the rest of the trick is to redefine some of the apps love functions. Like love.filesystem.getSaveDirectory needs to point to directory for the app, not the OS. Ect. ect. We'll post more as we update it.
I'll make seprate pages for the music video.
2025-04-11
Today i'm working on a music video.
2025-04-10
OK, its all stable enough to be able to work on the experimental DAW. Epic.
2025-04-09
Today I defined the .lib and .slib file types. These are liraries specfic to PusedOS. A .lib is a folder that is ment to be run in a certain way by a certain lua function. We can also have a .lib.lua file. A .lib is defined as such. You can use ... in the file / files of the .lib to get acsess to the libraries table.
local miscLibrary = ...
function miscLibrary.someFunction()
return ';)'
end
Then inside an app we can do something like this. The includeLib takes care of initalizing and returning the library.
local app = ...
local miscLib = app:includeLib'miscLibrary'
print(miscLib.someFunction())
All Libraries have are given acsess to the LoveApps functions via their metatable's __index.
Folder libraries atomatically include any .libs they contain. Say given this folder stucture.
misc.app/
| init.lua
| child.app/
| | init.lua
| | coolFunctions.lib/
| | | dependent.lib/
| | | | init.lua
| | | init.lua
| | | extraStuff.lua
| main.lua
| .loveapps/
...
Love2D can run the misc.app triggering main.lua. main.lua loads LoveApps via the included .loveapps folder. LoveApps loads misc.app -> loads child.app (init.lua) -> loads coolFunctions.lib -> loads dependent.lib. You get the picture.
The main thing I need to figure out right now is Shared Libraries (.slib). These exsist mainly for the Ui system, which should not have seprate instances per LoveApp, but rather a main class. Saves on rescorces as well. The main thing is cross compatablity. How to include shared libs in the indevidual apps to make them atonimus, ect. Some main list of names so love apps are cross compatable? Who knows... The reason to make it a .slib not just part of LoveApps is because i'd like LoveApps to be able to create apps that don't need this Ui Library.
Currently getting the Autoloader working so that we can do work on the experimental DAW idea. :) shhh its a sequet