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

GNU Bash

1.3K
707
+ 1
8
Lua

2.3K
990
+ 1
180
Add tool

GNU Bash vs Lua: What are the differences?

Introduction

This Markdown code provides a comparison between GNU Bash and Lua, highlighting the key differences between the two programming languages.

  1. Variable Declaration and Scope: In GNU Bash, variables are implicitly declared and have a global scope unless explicitly defined as local. In contrast, Lua requires explicit variable declaration and provides options for local and global scope control.

  2. Data Types: GNU Bash primarily deals with strings, with limited support for numeric operations. Lua, on the other hand, supports various data types including strings, numbers, booleans, tables, functions, and userdata.

  3. Syntax and Control Flow: Bash uses a shell scripting syntax with built-in commands and functions for tasks such as file manipulation and system management. Lua utilizes a more traditional programming syntax with constructs like loops, conditionals, and functions, making it more suitable for general-purpose programming tasks.

  4. Arrays and Tables: In Bash, arrays are implemented as strings with special delimiters. Lua provides built-in support for tables, a more versatile data structure capable of storing different data types and offering advanced features like key-value pairs and iteration.

  5. File Handling: While both languages can handle file I/O operations, GNU Bash has native support for file rediirection, allowing easy manipulation of input and output streams. Lua requires the use of its file I/O libraries to perform similar operations.

  6. Script Execution: In Bash, scripts are typically executed from the command line as shell scripts. Lua scripts, on the other hand, are usually executed within the Lua interpreter or embedded in applications that have Lua support.

In summary, GNU Bash focuses on shell scripting and system management, providing simplicity and quick command execution, while Lua offers a more comprehensive programming language with extensive data types, syntax, and control flow constructs for general-purpose programming tasks.

Advice on GNU Bash and Lua
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
Cofounder at Wanderloop · | 7 upvotes · 379.8K views
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 GNU Bash and Lua
Justin Dorfman
Open Source Program Manager at Reblaze · | 1 upvote · 80.6K views

If you have a file (demo.txt) that has 3 columns:

Column-1    Column-2    Column-3
Row-1a      Row-2a      Row-3a         
Row-1b      Row-2b      Row-3b
Row-1c      Row-2c      Row-3c
Row-1d      Row-2d      Row-3d
Row-1e      Row-2e      Row-3e

and you want to only view the first column of the file in your CLI, run the following:

awk {'print $1'} demo.txt

Column-1
Row-1a
Row-1b
Row-1c
Row-1d
Row-1e

If you want to print the second column of demo.txt, just replace $1 with $2

See more
Get Advice from developers at your company using StackShare Enterprise. Sign up for StackShare Enterprise.
Learn More
Pros of GNU Bash
Pros of Lua
  • 3
    Customizable
  • 3
    Powerful scripting language
  • 2
    Widely adopted
  • 0
    Cross platform
  • 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

Sign up to add or upvote prosMake informed product decisions

Cons of GNU Bash
Cons of Lua
  • 1
    Too Slow
  • 4
    Nooby
  • 2
    Not widespread
  • 1
    D
  • 0
    Python

Sign up to add or upvote consMake informed product decisions

- No public GitHub repository available -

What is GNU Bash?

The Bourne Again SHell is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). It is intended to conform to the IEEE POSIX P1003.2/ISO 9945.2 Shell and Tools standard.

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.

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

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

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

What tools integrate with GNU Bash?
What tools integrate with Lua?

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

Blog Posts

GitHubDockerReact+17
40
36284
GitHubPythonNode.js+26
29
15959
What are some alternatives to GNU Bash and Lua?
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.
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.
HTML5
HTML5 is a core technology markup language of the Internet used for structuring and presenting content for the World Wide Web. As of October 2014 this is the final and complete fifth revision of the HTML standard of the World Wide Web Consortium (W3C). The previous version, HTML 4, was standardised in 1997.
PHP
Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.
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!
See all alternatives