Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Articles by Mukul Latiyan
Page 35 of 37
How to embed Lua codes in Java?
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 of Lua in Java works, and we will also explore the most commonly used project that does this for us.Embedding Lua with Java simply means the fact we should be able to run the code inside the Lua file with the help of the java commands. Just like how we ...
Read MoreRead-only tables in Lua programming
While working with tables, we can easily access and modify the values present in the tables provided we know the key. But there are cases where we would like our tables to be in read-only format so that the values present inside the table cannot be modified.There are many benefits for this particular approach as we can make use of such read only tables in storing information that we don’t want anyone to mutate, like storing data of employees.In order to make any table a read only table we make use of the setmetatable() function along with __index and __newindex ...
Read MorePassing Lua script from C++ to Lua
The idea of passing Lua script from C++ to Lua includes the fact that we will have to load the libraries and header files as Lua is ANSI C, and if we are coding in C++, we will need to enclose the #includes in extern “C”.The old and mostly used approach would be to load the libraries that Lua provides and then simply call the C++ function from Lua.In order to load the script from C++ to Lua, we need to set up and shutdown the Lua interpreter and we can do that with the help of the following code.ExampleConsider ...
Read MoreLua pattern matching vs regular expression
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 the examples become more complex and it can handle variety of cases, but this does not mean that the Lua’s pattern matching is bad. In fact, it is easier to understand and it works like a charm too.Instead of using regex, the Lua string library has a special set of ...
Read MoreWhat are some of the important Scientific Libraries used in Lua programming?
While we know that Lua does a great job when we want to use it as an embedded language, it can also exceed its basic uses and can be used in extreme cases such as Machine Learning and statistical analysis.There are many scientific libraries that are present in the market for this particular case of making more out of Lua. Let’s explore what these libraries are and what they do.The first name that comes to my mind when talking about Lua and machine learning in the same sentence is of the Torch project. The torch project is a scientific computing ...
Read MoreNull Aware Operators in Dart Programming
Dart has different null aware operators that we can use to make sure that we are not accessing the null values and to deal with them in a subtle way.Mainly, these are −?? operator??= operator? operatorWe will go through each of them in the following article.?? operatorThe ?? operator returns the first expression if and only if it is not null.ExampleConsider the example shown below −void main() { var age; age = age ?? 23; print(age); var name = "mukul"; name = name ?? "suruchi"; print(name); }In the above example, we declared two ...
Read MoreImmutability in Dart Programming
Immutability is the ability to remain constant. Whenever we talk about immutability we mention the immutable nature.In object oriented and functional programming, we make use of the immutable nature of objects a lot. Being immutable means that the state of the object cannot be modified after its creation.It is a very important topic these days when we talk about front-end development, as there are several occasions and scenarios where we want to maintain the state and the way to do that is to make use of immutability.In Dart, there are different ways with which we can achieve immutability and sometimes ...
Read MoreFuture class in Dart Programming
There are different classes and keywords in Dart which we can use when we want to run Asynchronous code. The future class allows us to run asynchronous code and we can also avoid the callback hell with the help of it. A future mainly represents the result of an asynchronous operation.In Dart, there are many standards library calls that return a future, some of them are −http.getSharedPreference.getInstance()A future in Dart can have two states, these are −Completed - When the operation of the future finishes and the future complete with a value or with an error.Uncompleted - When a function is called, and it ...
Read MoreComments in Rust Programming
Comments in Rust are statements that are ignored by both the rust compiler and interpreter. They are mainly used for human understanding of the code.Generally, in programming, we write comments to explain the working of different functions or variables or methods to whosoever is reading our code.Comments enhance the code readability, especially when the identifiers in the code are not named properly.In Rust, there are multiple ways in which we can declare comments. Mainly these are −Single-line commentsMulti-line commentsDoc commentsIn this article, we will explore all the three comments.Single-Line commentSingle line comments in Rust are comments that extend up to ...
Read MoreUse Declarations in Rust Programming
Use Declarations in Rust are used to bind a full path to a new name. It can be very helpful in cases where the full path is a bit long to write and invoke.In normal cases, we were used to doing something like this:use crate::deeply::nested::{ my_function, AndATraitType }; fn main() { my_function(); }We invoked the use declaration function by the name of the function my_function. Use declaration also allows us to bind the full path to a new name of our choice.ExampleConsider the example shown below:// Bind the `deeply::nested::function` path to `my_function`. use deeply::nested::function as my_function; ...
Read More