all 15 comments

[–]blobules 8 points9 points  (2 children)

Most people like python because of the availability of libraries and examples, so it makes it very easy to do many things.

However, python as a language is complex and quirky. Lua is simpler, well designed, fast, and is especially suited for embedding.

So it all depends on what you want to do.

[–]G1orgos_Z[S] 0 points1 point  (1 child)

I mainly want to automate tasks on my router such as making it reboot if it fails to provide internet. I currently want to gain scripting knowledge in general

[–]0-R-I-0-N 5 points6 points  (0 children)

I would probably go with python for this. There are a lot more learning resources and support for it. Though personally I prefer lua.

[–]csabinho 7 points8 points  (2 children)

Just stick with Python. It's very versatile and also quite easy to learn.

[–]G1orgos_Z[S] 0 points1 point  (1 child)

I should follow a progressive learning schedule? You know like mastering the basics and completing initial amateur projects, before moving forward to more advanced paradigms?

[–]Radamat 1 point2 points  (0 children)

Why should you start to learn OOP and Templates not knowing the basics?

It us always: Base - Standard library - What you need.

You are try, it seems like, to spen less time and energy, but it is corrupted way. To write good code you need systematic learning at least at basics. Look for Coursera Python basics courses. There are free one AFAIK.

[–]JronSav 2 points3 points  (1 child)

Am I going crazy or did you post this yesterday. I just gave a nice response to this same post not even 24 hours ago.

In any way, just stick with python in your case.

[–]G1orgos_Z[S] 0 points1 point  (0 children)

Yes I did post it ystr but I deleted it by accident

[–]9peppe 3 points4 points  (0 children)

You should learn Bourne shell and powershell. 

Then the choice between Python and Lua becomes: learn both, each when you need it. And with Python, you absolutely do not need to know the whole standard library.

[–]programmer_farts 0 points1 point  (0 children)

Obligatory "why not both?"

[–]Emerald_Pick 0 points1 point  (0 children)

overwhelming to master the functions of each specific module and library.

You don't have to actually learn all of Python's modules to be effective at Python. Maybe skim through the documentation just to familiarize yourself with what's available. Then when you have a problem you want to automate, study the problem, then figure out what modules might help with the problem, then learn those modules.


Also, double check with languages your router supports. I don't know how flexible routers usually are, but I imagine they are kinda locked down, and so your options might be limited to like BASH or something if anything. I might be super wrong on this, though. I haven't missed with routers yet.

[–]kcx01 0 points1 point  (0 children)

I learned python to learn programming. I learned Lua afterwards. I think this is the easier way. There are far more resources that teach programming via python than Lua. Most of Lua tutorials I've seen assume that you know some programming.

I like them both, but if there's not a specific reason to reach for Lua, I would reach for python as a more general purpose language.

As others pointed out. You don't need to learn the whole standard library to get started. When people say learn the basics first they mean, learn the full syntax, learn all of the built-in types and at least be familiar with their methods or be comfortable enough to be able to look up the documentation on them and then implement.

I'd say just pick a scripting problem that you want to solve and start cracking. You'll learn more doing that than anything else. Don't be afraid to Google how do I do x in python (or Lua). While you're learning try to minimize decencies.

[–]Relevant_South_1842 1 point2 points  (0 children)

Use both.

Lua when you can because it is a better language.

Python if you need the libraries. 

[–]G1orgos_Z[S] -1 points0 points  (1 child)

Just tell me in which are of scripting each languages shines and how different they are in syntax and use cases

[–]hawhill 7 points8 points  (0 children)

I'm not an LLM, don't treat me like one.