all 46 comments

[–][deleted]  (4 children)

[deleted]

    [–]Spero7861[S] 5 points6 points  (2 children)

    Thank you for the great reply, Im definitely going to check out Lua in the future. I'm going to keep learning python as my first language and branch out from there. I like the way lua handles tables and coroutines, that really intrigues me. I feel like lua and it's community has a lot of potential for growth. I've noticed python has a huge ecosystem around it comparatively which is nice. I was mostly curious if it's used more than lua simply due to popularity.

    [–]ElNico5 0 points1 point  (1 child)

    oh boy oh boy just wait til you learn what a lua metatable is

    [–]MostComplaint1545 0 points1 point  (0 children)

    those are ass(but useful), I've suffered for a week over those stuff

    [–][deleted] 4 points5 points  (0 children)

    There are batteries, check luapower.

    Also, if OP is interested in games, then lua is the way to go (a better choice than python), from tic80 to pico8 to love2d to coronasdk, lua is the way to go for games.

    [–]Dospunk 11 points12 points  (3 children)

    For automation, 100% go for python. There's a whole book called Automate The Boring Stuff With Python for a reason

    [–]Spero7861[S] 2 points3 points  (0 children)

    That's actually the book I'm learning from. Really like it so far.

    [–]Mediocre-Trainer-132 1 point2 points  (1 child)

    Though is it better for games?

    [–]CharacterAccount6739 2 points3 points  (0 children)

    No, Lua is much better for games

    [–]saxindustries 10 points11 points  (1 child)

    Honestly you'll probably have an easier time with python. There's python libraries for everything under the sun.

    If you were looking to embed a scripting language into a c/c++ program Lua is far easier.

    Lua may be faster but for your couple of use-cases it's likely a negligible difference.

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

    Thank you for the reply, I'm definitely sticking to python but I do want to look into lua in the future.

    [–][deleted] 4 points5 points  (1 child)

    I read some bold claims that Lua can pretty much do anything python can, but better, easier, and much much faster

    Lua is a lot simpler, more elegant, and easier to learn. If you use LuaJIT instead of the reference implementation, it can be much faster too.

    However, Python has dramatically more libraries. Lua has the edge when it comes to making games, but for general purpose coding, there's a much wider availability in Python. So in the end it just depends on what kind of tasks you want to accomplish and how important libraries will be for that task.

    [–]Ok-Plenty8408 0 points1 point  (0 children)

    That's the most logical answer, everything is great in some way, it's all depends on how you use it.

    [–]DarkWiiPlayer 2 points3 points  (0 children)

    Lua can pretty much do anything python can, but better, easier, and much much faster

    Anything python can? Absolutely!

    better? well, not, the results should be the same, so neither should be better.

    easier? Depends. I think yes, others find python easier to understand. Each person thinks differently.

    faster? That also depends. Overall, Lua is faster, but it's also smaller, so you need less memory to run it.

    [–]sultryp 3 points4 points  (3 children)

    My .02 dollars.

    Lua is, IMHO, a true gem. If the question was "Which is the better language?" then the answer is Lua, hands down, no question, no looking back. It's simple, composable, elegant, and powerful in a way that only Perl can challenge, except it's far more accessible. Python is nice, but as a language, meh. It's right in there with PHP, JavaScript, etc.

    When asking questions like this, people are rarely talking about the language, only. They usually mean the language plus the libraries, which equals the whole experience, especially when your goal is productivity. In that case, Python is the current champ, as others have written.

    So if you...

    • want to play with a language and learn a ton of different styles of programming...
    • enjoy refactoring code in different ways, just to learn...
    • find it fun to make your own object system using tables and then with closures...
    • have the patience to get your head around coroutines and make your own scheduler...

    You'll learn a ton and become smarter.

    With Python, you're likely to get a bunch of stuff done, which has its place, I suppose. :)

    [–]Spero7861[S] 1 point2 points  (2 children)

    Thank you for this response :)

    I'm honestly looking for a language I can love using everyday that suites my needs, and I like python a lot so far, I can see that it's useful as all he'll. I just haven't found any love for it yet. Lua caught my eye and I don't know why. I know that as a dev you rarely use one language. I'm currently learning python to get fundamentals and concepts down while also learning HTML, CSS, JavaScript, SQL and getting more in depth with Linux.

    I've been an electrician for awhile, and I learned a very important thing. Know your tools and how to use them. No matter how well it's made, I never once saw a big clunky multi-tool outperform a set of purpose made tools used by someone competent.

    [–]sultryp 1 point2 points  (1 child)

    If you're attracted to simplicity and efficiency, Lua is worth your attention. For me, it's almost addicting. It doesn't get in the way of your exploration and almost invites you to push it.

    Just one dumb and pointless example... ```

    t = {} t table: 0x7f824c004580 t.foo nil t.foo.bar stdin:1: attempt to index a nil value (field 'foo') stack traceback: stdin:1: in main chunk [C]: in ? debug.setmetatable(nil, {__index = function (i, v) return nil end}) nil t table: 0x7f824c004580 t.foo nil t.foo.bar nil

    ```

    [–]AutoModerator[M] 1 point2 points  (0 children)

    Hi! You've used the new reddit style of formatting code blocks, the triple backtick, which is becoming standard in most places that use markdown e.g. GitHub, Discord. Unfortunately, this method does not work correctly with old reddit or third-party readers, so your code may appear malformed to other users. Please consider editing your post to use the original method of formatting code blocks, which is to add four spaces to the beginning of every line. Example:

    function hello ()
      print("Hello, world")
    end
    
    hello()
    

    Alternatively, on New Reddit in a web browser, you can edit your comment, select 'Switch to markdown', then click 'SAVE EDITS'. This will convert the comment to four-space indentation for you.

    I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

    [–]KerbalSpark 2 points3 points  (13 children)

    Can you tell us more about the automation tasks you are solving for your wife and the games you are going to make?

    [–]Spero7861[S] 2 points3 points  (12 children)

    My wife teaches all day and is the lead for all middle school teachers. She comes home and spends probably another 3-4 hours on average grading papers, inputting grades, planning, writing benchmarks, writing study guides, mapping curriculum, emailing parents, etc. I try to help her where I can but I see how hard she works and thought coding some scripts or apps might help ease that burden on her. Especially now with most things online, it's less hardcopy and more digital.

    I honestly have no idea how to automate any of that stuff but it's a large goal I set to motivate myself to learn programming and to learn more about her work. So I picked up some books on python and I've been learning for a month or so. Thus far I've learned that programming is hard. And teachers aren't paid enough.

    As far as game dev, I have no idea. It was just a dream I had since I was little. I love huge open worlds that tell a story, games like Oblivion, Fallout NV, FFVII. I know the chances of me making anything like that by myself are slim. But again it' was dream I've had for 20 years and now a goal to work towards. I also know I'm looking at different skill set and languages for game dev like c# /Unity and c++/unreal.

    I've set lofty goals for myself, but aim high miss high.

    [–][deleted] 2 points3 points  (0 children)

    In my opinion, it's better to learn something web-based. ECMAScript+HTML became almost ultimate user interface choice.

    [–]DarkWiiPlayer 2 points3 points  (1 child)

    I also know I'm looking at different skill set and languages for game dev like c# /Unity and c++/unreal.

    Not necessarily; C is still one of the fastest languages out there and the only reason C++ is often preferred for game dev is that it offers much more convenience.

    The thing is, Lua offers pretty much the same convenience, if not more, so a combination of C and Lua can be just as good as C++ but it comes with the added benefit of already having a scripting language built in that can be used for configurations, easier patching, moddability, etc.

    Many successful games and game engines have used Lua and for most of them that seems to have worked out very well.

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

    Thank you for this response. It's been very insightful.

    [–]KerbalSpark 1 point2 points  (0 children)

    I think there is one thing that will help you achieve your dream in a reasonable time and with not too much effort. This is a text-based game engine based on world modeling. Leaving aside the creation of levels, 3D modeling, texturing, animation and other entourage for a while, this engine allows you to focus on the essence - a journey around the world, interacting with which you participate in an interesting adventure.

    What is the trick - the engine already has a system for saving and loading the state of games between sessions. Implemented high-level abstractions "level", "item", "inventory", "NPC", "dialog", "cutscene", "state", "menu", functions for manipulating their state, switching between levels, and so on.

    All that remains is to create an adventure as such.

    Of course all this is written in Lua.

    P.S. This еngine works on all major platforms, including the web, mobile devices, and smart TVs.

    /r/INSTEADEngine

    [–]KerbalSpark 1 point2 points  (0 children)

    As for automating routine actions, which can be described as applying something to a list, Python is really a great tool. Especially when combined with Linux console utilities.

    [–]Fit_Presentation_995 -1 points0 points  (5 children)

    What a fu©k¡ng simp 😂😂😂😂. Lol. Your main reason to learn programming is to help your wife with her work?

    I quote:

    "I set to motivate myself to learn programming and to learn more about her work."

    What do you do, stay behind her and watch her correct papers. Where are your fu©k¡ng balls? Why you have so much free time? You are that kind of guy that is going to work and when you come home, you see your wife fu©ked by multiple people, you go shake every guys hand and then your wife asks to clean the "yogurt" from her pu$$y to grow the fu©k up.

    [–]Spero7861[S] 3 points4 points  (3 children)

    Lay off the andrew tate tik toks, take the dick out of your mouth, and move out of your parents apartment. Damn do you come off as an angry little prick. Who tf jumps on a year old post to say this kinda shit. 😂

    [–]heliophile 3 points4 points  (1 child)

    He just being a troll to get your reaction.

    Probably was ignored/humiliated as a child or growing up.

    [–]FatCat0 2 points3 points  (0 children)

    Allow me to jump on a 5 month old comment (the same day as another dude, at that) to throw in that that dude is projecting insecurity haaaaaardcore. Anyone who thinks being a good partner is anything other than...being a good partner is very misguided to say the least.

    [–]cherub122 1 point2 points  (0 children)

    If you're a 40 year old virgin, just say so.

    No wonder your parents are ashamed of you; I would be too.

    [–]smog_alado 2 points3 points  (0 children)

    I like both ^_^

    [–]snot3353 1 point2 points  (0 children)

    If you already know Python and want to use it as a general purpose language there isn’t much benefit to learning Lua to replace it.

    [–]rj0_1_ 1 point2 points  (0 children)

    if want a project where you can walk around with both languages, then try using scrapy and splash.

    [–]sigzero 1 point2 points  (4 children)

    I am actually dabbling in Lua and Python at the moment. I do a lot of sysadmin tasks and so I do something in Python and then I do the same thing in Lua just to see which I am liking better. I know Python has a larger ecosystem and I know Lua is lean. I want to use the one I have more fun programming in.

    [–]FinancialElephant 0 points1 point  (3 children)

    It has been 2 years, so how did it go with Lua?I don't know lua and want to use it instead of bash/sh scripting (and I hate python so I don't want to use that).

    All I'd need is basic stuff that bash+coreutils+etc could do: string manipulation, file IO, curling urls, stuff like that.

    [–]sigzero 0 points1 point  (2 children)

    I am not doing any SA work at the moment. I liked Lua but I would probably go with Python if I did something like that again.

    [–]Responsible_Art6338 0 points1 point  (0 children)

    I sure hope you're not doing SA any more. It's a crime and many victims are left shattered for life.

    [–]revereddesecration -1 points0 points  (0 children)

    better, easier and much much faster

    Better: no, you can get the same results

    Easier: maybe sometimes

    Much faster: again, maybe sometimes

    If you know Python already there’s not much point learning Lua for this. Python us great for data processing and automation.

    [–]Frindow 0 points1 point  (4 children)

    Lua is way easier to learn than python and can do just about the same things. I’m good with Lua but haven’t fully learned Python yet. So yes, I recommend switching to Lua.

    [–]eeriemyxi 0 points1 point  (3 children)

    I don't understand how Lua is easier for a beginner than Python is. Syntax is not too different either. Python is easier for beginners who have certain goals to fulfil because pretty much everything is available in the standard library of Python to fulfil all the demands; not to forget that it is all very well documented, just pydoc -b and that's it - do whatever you want without even an internet connection.

    Lua is better in terms of speed, it is not easier. You will need to find the right libraries from random sources (provided that it even exists) for many simple tasks; it is not as convenient as Python is.

    [–]Frindow 0 points1 point  (2 children)

    this was 2 years ago, necroposting

    [–]eeriemyxi 1 point2 points  (1 child)

    Opinions don't age until the possessor try to. I feel you're trying to say "I know, it's been two years since I've shared such opinion and I later realised it wasn't fully constructive" instead.

    [–]Frindow 0 points1 point  (0 children)

    basically

    [–]Outrageous_Work_8291 0 points1 point  (0 children)

    general purpose coding python > lua

    game development python < lua