theres so much lua syntax that's possible but nobody is stupid enough to implement. did you know that ~ can represent two separate operators depending on whether it's infix or prefix (~a~b~c)? did you know you can override arithmetic methods for builtin types? this leaks into whatever includes it, too
debug.setmetatable("", {
__div = function(self, other)
local res = tonumber(self)
if type(other) == "table" then
for _, v in ipairs(other) do
res = res / tonumber(v)
end
else
res = res / tonumber(other)
end
return tostring(res)
end
})
print("result:")
print(("50" / { 10, 10 }))
i love how lua provides minimal syntax but proceeds to make it exploitable enough to make this possible:
-- i couldn't actually find the code for this, but this is the syntax part:
function class(name)
return function(tbl)
-- ...
end
end
class "Rect" {
x = 0,
y = 0,
w = 1,
h = 1,
AABB = function(self, other)
if self.x < other.x + other.w and
self.x + self.w > other.x and
self.y < other.y + other.h and
self.y + self.h > other.y then
return true
end
return false
end
-- you get the idea
}
did you know you can override arithmetic methods for builtin types? this leaks into whatever includes it, too
Hi! Your code block was formatted using triple backticks in Reddit's Markdown mode, which unfortunately does not display properly for users viewing via old.reddit.com and some third-party readers. This means your code will look mangled for those users, but it's easy to fix. If you edit your comment, choose "Switch to fancy pants editor", and click "Save edits" it should automatically convert the code block into Reddit's original four-spaces code block format for you.
Hi! Your code block was formatted using triple backticks in Reddit's Markdown mode, which unfortunately does not display properly for users viewing via old.reddit.com and some third-party readers. This means your code will look mangled for those users, but it's easy to fix. If you edit your comment, choose "Switch to fancy pants editor", and click "Save edits" it should automatically convert the code block into Reddit's original four-spaces code block format for you.
5
u/titaniumalt Dec 11 '25
half of me tells me to hate it, half of me tells me to love it
17
u/no_brains101 Dec 11 '25
lol "soup" because its just a random mash of functions for various languages fair enough
You might like fennel btw but that is definitely cool!
1
u/xoner2 Dec 11 '25
Can you make it
"six" >> cout?1
u/[deleted] Dec 12 '25
Dude what is going on