Mukul Latiyan has Published 474 Articles

math.min() function in Lua

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 11:56:18

6K+ Views

There are several occurrences when we want to get the min value from a given series of numbers and then use that value later on.The Minimum value from the series of different numbers is the value that is the minimum of all the numbers that are present in that series.Lua ... Read More

math.max() function in Lua programming

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 11:53:24

8K+ Views

There are several occurrences when we want to get the max value from a given series of numbers and then use that value later on.The Maximum value from the series of different numbers is the value that is the maximum of all the numbers that are present in that series.Lua ... Read More

math.floor() function in Lua programming

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 11:47:04

11K+ Views

There are several occurrences when we want to get the floor value of an integer to round it off and then use that value later on. The floor value of a number is the value that is rounded to the closest integer less than or equal to that integer. Lua ... Read More

math.ceil() function in Lua programming

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 11:45:58

5K+ Views

There are several occurrences when we want to get the ceil value of an integer to round it off and then use that value later on.The Ceiling value of a number is the value that is rounded to the closest integer greater than or equal to that integer.Lua provides us ... Read More

Lua pattern matching vs regular expression

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 11:43:09

860 Views

It is known that the design of the pattern matching that Lua follows is very much different, then the regular expression design which is generally based on POSIX.They have very less in common, and the more popular approach would be POSIX out of the two because it works great when ... Read More

Lexical Conventions in Lua Programming

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 11:42:06

212 Views

In this article, we will learn how to declare and write different lexical conventions in Lua programming.In Lua, we call NAMES as IDENTIFIERS and they can be any string of letters, digits, and underscored, and they should not begin with a digit.Let’s consider an example of different Identifiers in Lua ... Read More

Why does Lua have no “continue” statement?

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 11:36:51

3K+ Views

There’s no continue statement in Lua, and it’s not because the developers of the Lua programming language felt that it is of no use, in fact, in the official documentation they mentioned “continue was only one of a number of possible new control flow mechanisms”. This clearly shows that the ... Read More

Why do Lua arrays (tables) start at 1 instead of 0?

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 11:34:35

1K+ Views

Yes, the arrays in Lua start with index 1 as the first index and not index 0 as you might have seen in most of the programming languages.ExampleConsider the example shown below − Live Demoarr = {10, 11, 12, 13, 14} print(arr[0]) print(arr[1])In the above example, we are printing the values ... Read More

What is the difference between pairs() vs. ipairs() in Lua?

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 11:31:58

9K+ Views

In Lua, we make use of both the pairs() and ipairs() function when we want to iterate over a given table with the for loop. Both these functions return key-value pairs where the key is the index of the element and the value is the element stored at that index ... Read More

What does operator ~= mean in Lua?

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 11:30:44

1K+ Views

The ~= symbol or operator in Lua is known as the not-equal to operator. In many programming languages you might have seen the symbol != which is also known as the not equals operator.Let’s consider a few examples where we can make use of the not equals operator.ExampleConsider the examples ... Read More

Advertisements