Mukul Latiyan has Published 474 Articles

How to push a Lua table as an argument?

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 12:41:01

483 Views

We may want to push the Lua table as an argument to a code written in C++ which uses Lua as an embedded language and for that case we need to make use of the different API functions that the Lua library provides us with.ExampleThe Lua code will look something ... Read More

How to make a namespace in Lua programming?

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 12:37:09

1K+ Views

A namespace is a declarative region that provides a scope to the identifiers (the names of types, functions, variables, etc) inside it.In simple words, a namespace is a class of elements in which each element has a unique name to that class. It is used to organize code into logical ... Read More

How to iterate individual characters in a Lua string?

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 12:35:32

2K+ Views

A string in Lua is a sequence of characters that we can iterate over in different ways.After Lua 5.1, we have many approaches which we can use to iterate over the characters that made a string, and we can even do anything we want with them, like make use of ... Read More

How to Implement a Queue in Lua Programming?

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 12:32:11

838 Views

There are different approaches one can take to declare a queue in Lua; the most basic one is to make use of the tables and repeat function, and take two variables that will help us to insert and delete elements from the queue.ExampleConsider the code shown below − Live Demoqueue = ... Read More

How to get the number of entries in a Lua table?

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 12:28:55

2K+ Views

While there are many functions and operators that we can use to get the size of the integer entries in a particular table in lua, there's no defined method or function which works for a table that contains data that is not homogeneous in nature.Let’s consider a simple table where ... Read More

How to Encode and Decode JSON and Lua Programming?

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 12:26:59

3K+ Views

JSON is short for JavaScript Object Notation. It is a type of format that is very widely used in the programming world, but it is only a text format in its entirety. There are many JSON libraries available for Lua, but the most commonly used library is lunajson.In this article, ... Read More

How to embed Lua codes in Java?

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 12:24:48

1K+ Views

Lua is probably the most commonly used embedding language that can be integrated or embedded into different major programming languages. There are different projects that does this work of embedding for us, Lua has been embedded into C, C# and Java also.In this article, we will explore how the embedding ... Read More

string.upper() function in Lua programming

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 12:23:07

6K+ Views

There are certain scenarios in our code that when we are working with the strings, we might want some string to be in uppercase, like consider a very basic and yet famous example of such scenario, the PAN number.Imagine that you are making a web form in which there’s a ... Read More

string.lower() function in Lua programming

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 12:19:22

6K+ Views

There are certain scenarios in our code that when we are working with the strings, we might want some string to be in lowercase, like consider a very basic case of an API which is using an authentication service, and the password for that authentication service should in lowercase, and ... Read More

string.gsub() function in Lua programming

Mukul Latiyan

Mukul Latiyan

Updated on 19-Jul-2021 12:18:09

15K+ Views

There are scenarios when we want to change a pattern that we found in a string with our pattern, and in Lua for that we have a famous library function, named the string.gsub() function.The string.gsub() function has three arguments, the first is the subject string, in which we are trying ... Read More

Advertisements