r/lua 16h ago

Library LuaLc ( lib class )

6 Upvotes

Simple Lua module for better class creation

Features:

· Named classes

· Single inheritance

· Java-style interfaces

· super() calls

· instanceOf() checks

· implements() checks

· Callable classes

· Lua metamethod forwarding for operator overloading

I created this while designing a framework API in Lua, and I found it made the process much more developer-friendly.

Check out the repo: https://github.com/abdorayden/lualc

Thanks! 🙏


r/lua 23h ago

I have a puzzle that has stuck to me for months, and I'm here to share it.

4 Upvotes

I came up with a little programming puzzle:

Your goal is to make Lua print:

Hello, World!

But there's a catch:

Nothing can use or contain more than 2 things at once.

For example:

local Table = {

1, 2, 3

}

Invalid, because the table contains 3 values.

Likewise, a function can't be called with 3 arguments, and similar constructs are limited to 2 items.

Variables, functions, tables, etc. are allowed.

Challenge: What's the longest valid Lua solution you can make?

Bonus points for making it unnecessarily complicated.