Mukul Latiyan has Published 474 Articles

How to convert a string to int in Lua programming?

Mukul Latiyan

Mukul Latiyan

Updated on 20-Jul-2021 14:28:28

3K+ Views

Lua does the implicit conversion or also known as coercion when it notices that you are trying to use a number but wrote a string, then it automatically converts the string into an int, and it is quite useful.Let’s consider a simple example where I will declare a string variable, ... Read More

How to Convert Perl Compatible Regular Expressions (PCRE) into Lua

Mukul Latiyan

Mukul Latiyan

Updated on 20-Jul-2021 14:25:08

399 Views

A regular expression is a special text string that is used to describe a search pattern.PCRE (Perl Compatible Regular Expressions) is a C library implementing regex. It was written in 1997 when Perl was the de-facto choice for complex text processing tasks. The syntax for patterns used in PCRE closely ... Read More

How to convert JSON string into Lua table?

Mukul Latiyan

Mukul Latiyan

Updated on 20-Jul-2021 14:23:06

3K+ Views

When working with JSON we generally need to decode JSON into a string or maybe encode a string into JSON. Both of these processes of converting the string into a JSON or the opposite are seen frequently.While Lua doesn’t provide an official library to do the same, we can still ... Read More

How to compile embedded Lua code in C?

Mukul Latiyan

Mukul Latiyan

Updated on 20-Jul-2021 14:20:30

2K+ Views

We know that Lua does a great job when it comes to being a simple language and an embedded language. Lua works even better with C, because of the different libraries that provide a great amount of support for it.In order to compile embedded Lua in C, we need to ... Read More

How to Compile a Lua Executable?

Mukul Latiyan

Mukul Latiyan

Updated on 20-Jul-2021 14:16:51

513 Views

While there are different ways with which a person can compile a Lua executable, some of them require more time and resources.The most basic approach is to set the Lua Path environment variable and then simply run the lua command. While this might seem to be not much of a ... Read More

How to Call a Lua function from C?

Mukul Latiyan

Mukul Latiyan

Updated on 20-Jul-2021 14:15:47

2K+ Views

Calling a Lua function from C is something that requires a series of steps and a mastery in the Lua library functions. Lua provides several library functions that we can use whenever we want to call Lua functions from C or the opposite.Some of the most commonly used Lua library ... Read More

How does Garbage Collection work in Lua Programming?

Mukul Latiyan

Mukul Latiyan

Updated on 20-Jul-2021 14:12:54

228 Views

Lua provides automatic garbage collection that is very helpful in providing safe memory management. It basically means that you do not need to worry about the newly created object or how to allocate memory.Lua is running a garbage collector to collect all dead objects (that is, objects that can not ... Read More

How do you copy a Lua table by value?

Mukul Latiyan

Mukul Latiyan

Updated on 20-Jul-2021 14:11:34

1K+ Views

Copying a table means that we want all the values or pairs that are present in one table in another table. In Lua, there’s no standard library function that we can use to create such a table but we can create our own function to do so.Let’s create a function ... Read More

Differences between Javascript and Lua programming

Mukul Latiyan

Mukul Latiyan

Updated on 20-Jul-2021 14:08:31

177 Views

We know that there’s a huge gap in the popularity and use-cases of JavaScript and Lua. Besides this gap in popularity and use-cases, these languages have many differences at code level.The following table highlights some of the most notable differences between JavaScript and Lua.KeyJavaScriptLuaImplicit conversion when comparingJavaScript does implicit conversion ... Read More

Difference between . and : in Lua programming

Mukul Latiyan

Mukul Latiyan

Updated on 20-Jul-2021 14:07:09

5K+ Views

The .(dot) operator in Lua is used to invoke the method of an object, and it is a widely used operator in Lua.The :(colon) operator in Lua is used when you want to pass an invisible parameter to the method of an object that you are calling.Let’s consider an example ... Read More

Advertisements