Need advice about which tool to choose?Ask the StackShare community!

Lua

2.4K
986
+ 1
180
Ruby

44.9K
21.2K
+ 1
4K
Add tool

Lua vs Ruby: What are the differences?

Introduction

Lua and Ruby are two popular programming languages used for different purposes. While Lua is often used as an extension and scripting language, Ruby is a general-purpose programming language. Despite some similarities, these languages have several key differences that set them apart.

  1. Syntax: One of the main differences between Lua and Ruby is their syntax. Lua uses a C-like syntax with minimalistic features, making it easier to learn and read. On the other hand, Ruby has a more complex and expressive syntax with a rich set of features, making it a more versatile language.

  2. Type Systems: Lua has a dynamically typed system, allowing variables to hold values of any type. This flexibility can simplify development but can also lead to runtime errors. Ruby, on the other hand, has a strong static type system, ensuring type safety and reducing potential errors during development.

  3. Object-Oriented Programming: Both Lua and Ruby support object-oriented programming (OOP), but they have different approaches. Lua focuses more on simplicity and lightweight objects, while Ruby has a more comprehensive and traditional approach to OOP with features like classes, modules, and inheritance.

  4. Garbage Collection: Lua has a customizable garbage collector that allows programmers to fine-tune memory management based on their specific needs. In contrast, Ruby has a built-in garbage collector that automatically manages memory, making it easier for developers but less customizable.

  5. Library Support: Ruby has a vast ecosystem and a rich collection of libraries and frameworks, making it a popular choice for web development and other applications. Lua, although it has a smaller community, is widely used for embedded systems, game development, and scripting within other applications.

  6. Performance: When it comes to performance, Lua tends to be faster and more lightweight compared to Ruby. It is known for its efficiency and low memory footprint, making it suitable for resource-constrained environments. Ruby, on the other hand, emphasizes developer productivity and ease of use, sacrificing some performance benefits.

In summary, Lua and Ruby differ in syntax, type systems, approach to OOP, memory management, library support, and performance. These differences make them suitable for different use cases and development scenarios.

Advice on Lua and Ruby
Needs advice
on
JavaJavaLuaLua
and
PythonPython

I am trying to make Roblox game which requires Lua. I quite don't want to go with Lua just because other tools just might let me do more projects later on. I heard that Python is most similar to Lua, but I am still not sure which tool to use. Java, I think it will help me with many stuff later on for websites, projects, and more!

See more
Replies (2)
Rafey Iqbal Rahman
Recommends
on
LuaLua
at

Since you are trying to make a Roblox game, you have no other option than to use Lua, since Roblox only allows coding in Lua. Yes, you've heard right, Python is identical and as easy as Lua, although Lua is easier than Python. Beginning from Lua and then escalating to Python is recommended. Java is only helpful when you are creating a heavy, big-budget, enterprise-level product, otherwise, Python would suffice.

See more
Recommends
on
TypeScriptTypeScript

If you really hate lua check out roblox-ts, a tool that compiles typescript code into roblox lua. https://github.com/roblox-ts/roblox-ts

See more
Decisions about Lua and Ruby
Ing. Alvaro Rodríguez Scelza
Software Systems Engineer at Ripio · | 12 upvotes · 353.9K views

I was considering focusing on learning RoR and looking for a work that uses those techs.

After some investigation, I decided to stay with C# .NET:

  • It is more requested on job positions (7 to 1 in my personal searches average).

  • It's been around for longer.

  • it has better documentation and community.

  • One of Ruby advantages (its amazing community gems, that allows to quickly build parts of your systems by merely putting together third party components) gets quite complicated to use and maintain in huge applications, where building and reusing your own components may become a better approach.

  • Rail's front end support is starting to waver.

  • C# .NET code is far easier to understand, debug and maintain. Although certainly not easier to learn from scratch.

  • Though Rails has an excellent programming speed, C# tends to get the upper hand in long term projects.

I would avise to stick to rails when building small projects, and switching to C# for more long term ones.

Opinions are welcome!

See more
Timm Stelzer
VP Of Engineering at Flexperto GmbH · | 18 upvotes · 601.1K views

We have a lot of experience in JavaScript, writing our services in NodeJS allows developers to transition to the back end without any friction, without having to learn a new language. There is also the option to write services in TypeScript, which adds an expressive type layer. The semi-shared ecosystem between front and back end is nice as well, though specifically NodeJS libraries sometimes suffer in quality, compared to other major languages.

As for why we didn't pick the other languages, most of it comes down to "personal preference" and historically grown code bases, but let's do some post-hoc deduction:

Go is a practical choice, reasonably easy to learn, but until we find performance issues with our NodeJS stack, there is simply no reason to switch. The benefits of using NodeJS so far outweigh those of picking Go. This might change in the future.

PHP is a language we're still using in big parts of our system, and are still sometimes writing new code in. Modern PHP has fixed some of its issues, and probably has the fastest development cycle time, but it suffers around modelling complex asynchronous tasks, and (on a personal note) lack of support for writing in a functional style.

We don't use Python, Elixir or Ruby, mostly because of personal preference and for historic reasons.

Rust, though I personally love and use it in my projects, would require us to specifically hire for that, as the learning curve is quite steep. Its web ecosystem is OK by now (see https://www.arewewebyet.org/), but in my opinion, it is still no where near that of the other web languages. In other words, we are not willing to pay the price for playing this innovation card.

Haskell, as with Rust, I personally adore, but is simply too esoteric for us. There are problem domains where it shines, ours is not one of them.

See more
Andrew Carpenter
Chief Software Architect at Xelex Digital, LLC · | 16 upvotes · 399.1K views

In 2015 as Xelex Digital was paving a new technology path, moving from ASP.NET web services and web applications, we knew that we wanted to move to a more modular decoupled base of applications centered around REST APIs.

To that end we spent several months studying API design patterns and decided to use our own adaptation of CRUD, specifically a SCRUD pattern that elevates query params to a more central role via the Search action.

Once we nailed down the API design pattern it was time to decide what language(s) our new APIs would be built upon. Our team has always been driven by the right tool for the job rather than what we know best. That said, in balancing practicality we chose to focus on 3 options that our team had deep experience with and knew the pros and cons of.

For us it came down to C#, JavaScript, and Ruby. At the time we owned our infrastructure, racks in cages, that were all loaded with Windows. We were also at a point that we were using that infrastructure to it's fullest and could not afford additional servers running Linux. That's a long way of saying we decided against Ruby as it doesn't play nice on Windows.

That left us with two options. We went a very unconventional route for deciding between the two. We built MVP APIs on both. The interfaces were identical and interchangeable. What we found was easily quantifiable differences.

We were able to iterate on our Node based APIs much more rapidly than we were our C# APIs. For us this was owed to the community coupled with the extremely dynamic nature of JS. There were tradeoffs we considered, latency was (acceptably) higher on requests to our Node APIs. No strong types to protect us from ourselves, but we've rarely found that to be an issue.

As such we decided to commit resources to our Node APIs and push it out as the core brain of our new system. We haven't looked back since. It has consistently met our needs, scaling with us, getting better with time as continually pour into and expand our capabilities.

See more
Thomas Miller
Talent Co-Ordinator at Tessian · | 16 upvotes · 226.7K views

In December we successfully flipped around half a billion monthly API requests from our Ruby on Rails application to some new Python 3 applications. Our Head of Engineering has written a great article as to why we decided to transition from Ruby on Rails to Python 3! Read more about it in the link below.

See more
Mike Fiedler
Enterprise Architect at Warby Parker · | 3 upvotes · 217.8K views

When I was evaluating languages to write this app in, I considered either Python or JavaScript at the time. I find Ruby very pleasant to read and write, and the Ruby community has built out a wide variety of test tools and approaches, helping e deliver better software faster. Along with Rails, and the Ruby-first Heroku support, this was an easy decision.

See more
Get Advice from developers at your company using StackShare Enterprise. Sign up for StackShare Enterprise.
Learn More
Pros of Lua
Pros of Ruby
  • 41
    Fast learning curve
  • 26
    Very easy to embed in C programs
  • 26
    Efficient memory usage
  • 20
    Open source
  • 19
    Good for game scripting
  • 9
    Pretty simple to learn
  • 8
    Quick to code
  • 8
    Simple Language
  • 7
    Syntax is amazing
  • 7
    Supported in most game engines
  • 6
    D
  • 2
    Coroutines
  • 1
    Can be used for a wide variety of development
  • 605
    Programme friendly
  • 536
    Quick to develop
  • 490
    Great community
  • 468
    Productivity
  • 432
    Simplicity
  • 273
    Open source
  • 234
    Meta-programming
  • 207
    Powerful
  • 156
    Blocks
  • 139
    Powerful one-liners
  • 69
    Flexible
  • 58
    Easy to learn
  • 51
    Easy to start
  • 42
    Maintainability
  • 37
    Lambdas
  • 30
    Procs
  • 21
    Fun to write
  • 19
    Diverse web frameworks
  • 13
    Reads like English
  • 10
    Makes me smarter and happier
  • 9
    Rails
  • 8
    Very Dynamic
  • 8
    Elegant syntax
  • 6
    Matz
  • 5
    Object Oriented
  • 5
    Programmer happiness
  • 4
    Elegant code
  • 4
    Generally fun but makes you wanna cry sometimes
  • 4
    Friendly
  • 4
    Fun and useful
  • 3
    Easy packaging and modules
  • 3
    There are so many ways to make it do what you want
  • 2
    Primitive types can be tampered with

Sign up to add or upvote prosMake informed product decisions

Cons of Lua
Cons of Ruby
  • 4
    Nooby
  • 2
    Not widespread
  • 1
    D
  • 0
    Python
  • 7
    Memory hog
  • 7
    Really slow if you're not really careful
  • 3
    Nested Blocks can make code unreadable
  • 2
    Encouraging imperative programming
  • 1
    Ambiguous Syntax, such as function parentheses

Sign up to add or upvote consMake informed product decisions

What is Lua?

Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping.

What is Ruby?

Ruby is a language of careful balance. Its creator, Yukihiro “Matz” Matsumoto, blended parts of his favorite languages (Perl, Smalltalk, Eiffel, Ada, and Lisp) to form a new language that balanced functional programming with imperative programming.

Need advice about which tool to choose?Ask the StackShare community!

What companies use Lua?
What companies use Ruby?
See which teams inside your own company are using Lua or Ruby.
Sign up for StackShare EnterpriseLearn More

Sign up to get full access to all the companiesMake informed product decisions

What tools integrate with Lua?
What tools integrate with Ruby?

Sign up to get full access to all the tool integrationsMake informed product decisions

Blog Posts

Nov 20 2019 at 3:38AM

OneSignal

PostgreSQLRedisRuby+8
9
4626
Oct 24 2019 at 7:43PM

AppSignal

JavaScriptNode.jsJava+8
5
947
Jun 6 2019 at 5:11PM

AppSignal

RedisRubyKafka+9
15
1633
GitHubDockerReact+17
40
36148
What are some alternatives to Lua and Ruby?
Python
Python is a general purpose programming language created by Guido Van Rossum. Python is most praised for its elegant syntax and readable code, if you are just beginning your programming career python suits you best.
JavaScript
JavaScript is most known as the scripting language for Web pages, but used in many non-browser environments as well such as node.js or Apache CouchDB. It is a prototype-based, multi-paradigm scripting language that is dynamic,and supports object-oriented, imperative, and functional programming styles.
Arduino
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software.
Java
Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to datacenters, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!
Golang
Go is expressive, concise, clean, and efficient. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel type system enables flexible and modular program construction. Go compiles quickly to machine code yet has the convenience of garbage collection and the power of run-time reflection. It's a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language.
See all alternatives