LuaJIT Quick Tip 「Table Clear」
Posted by SysL, on January 22, 2025. [Link]
Ever wanted to empty a table without going though a loop or creating a new table and leaving it to the garbage collector?
Just table.clear(that_table)!
If you're writing a library and you're being nice to non-LuaJIT users, then you can just take a bit of extra time to check if it exists.
if table.clear then
table.clear(that_table)
else
-- deal with it another way
end
Love, Transparency and OBS
Posted by SysL, on January 21, 2025. [Link]
First of all, thank you @xkeeper for this, who found this worked even after being told "It can't be done". The code is below:
function love.draw()
-- This is all you need to do in your Love2D Code, set the background to transparent.
-- Note, this will still appear as black in the Love2D Game Window.
love.graphics.setBackgroundColor(0,0,0,0)
-- Draw things after here!
end
Setting up the OBS Capture
- Game Capture
- Mode: Capture Window
- Allow Transparency: True/Checked
That's It?
That's it. As long as you don't change the background, anything drawn in the love2D window will be drawn as if on top of a transparent background. Great for fun effects without having to use a chroma key.