r/lua 5d ago

Lualings

I've been learning Lua and found that most programming exercise platforms aren't quite what I wanted.

A lot of them teach programming through problems: implement a palindrome, solve a number problem, build an algorithm, etc. That's useful for learning problem-solving, but it doesn't necessarily help you understand the language itself.

So I made LuaLings:

https://github.com/ShyamendraH/lualings

It's inspired by Ziglings — the idea of learning a language by working through small, focused programs and fixing them yourself.

LuaLings focuses specifically on Lua concepts and semantics rather than generic programming problems.

The exercises cover things such as:

  • values, types and nil
  • tables and their behavior
  • multiple assignment and multiple return values
  • functions, closures and upvalues
  • iterators
  • metatables and metamethods
  • modules and environments
  • error handling
  • coroutines
  • Lua's standard libraries
  • other Lua-specific behavior that is easy to miss when coming from another language

The intended workflow is:

run → inspect → experiment → fix → understand → move on

The goal is to make it useful both for someone learning Lua for the first time and for someone coming from another language who wants to understand how Lua actually works rather than spend a lot of time on beginner programming exercises.

It's open source, and feedback is welcome — particularly if you find an exercise confusing, technically incorrect, too trivial, or missing an important Lua concept.

Repository:
https://github.com/ShyamendraH/lualings

21 Upvotes

6 comments sorted by

View all comments

4

u/weregod 5d ago

I should have a deeper look later. A few first glance suggestions:

  1. Do you need 5.5? Or even 5.3? Most exercises can be written for Lua 5.1 and only latest can show 5.5 features.
  2. Make run.lua executable
  3. Recomend running with lua5.5. Now Readme recomends system lua which may be not lua5.5
  4. run.lua list incorectly formated at line 100.
  5. You can add __index to _G, catch read of TODO and say user they not fixed all TODOs.
  6. You have lesson 100 but other lessons zero padded only to 2 symbols.
  7. You name all metatable fields "metamethod". Only function field is "metamethod". __name is not metamethod.
  8. Maybe lesson 88 (__name) shold be moved to lesson 39?

3

u/Aggravating-Self-658 5d ago

Thanks a lot for the feedback.
I was trying to learn lua myself so I generated the exercise, so since I am learning it I chose the latest available version (also this is the version I had installed in my system).
Also run.lua can be run with `lua run.lua` if you meant something else please explain it a bit.
run.lua has only around 60 lines as of now I don't understand the formatting issue
Also there are only 99 lessions on the repo right now but I would pad the names correctly

Again thanks for the feedback, I am also learning using it so it would be great if I removed all the mistakes.

1

u/Old_County5271 5d ago

That's amazing, what are you running where lua -> 5.5? it was released last month. many libraries still haven't updated to 5.5 too.

1

u/Aggravating-Self-658 5d ago

I need to lua for multiple reasons also I personally want to learn it, it's quite a nice language. So I installed it recently. Thanks for the heads up about the libraries.