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
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
How to push a Lua table as an argument?
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 like the code shown below −a = { numb = 10, create = function(a) print(a); end, increment = function(self) --self.numb = 11; print(self.numb); end, decrement = function(self, i) self.numb = self.numb-i; print(self.numb); end }; b = a;And the C++ code ...
Read MoreHow to Encode and Decode JSON and Lua Programming?
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, we will learn how to install lunajson first with the help of luarocks and then we will see how to work with luna-json and use it to cover the most common cases of encoding and decoding a string to JSON or vice versa. Finally, we’ll go over some more applicable ...
Read MoreHow 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 MoreState the differences between copyright and patent
In simple words a patent is nothing but securing an invention and copyrights are nothing but securing original ideas. Both are governed by different rules and regulationsCopyrightsThe main objective of copyright is to secure the original idea or expression of idea of an artist. An artist's work can be a computer program, music, song, movie or any original work. Example − a book written by a cook.Others can't reproduce the same book or without permission of the book but however they can use the recipes used in it. To get copyrights, the artist first has to register with the respective ...
Read MoreDifferentiate between trademark and copyright
Copyright and trademark comes under intellectual property. Although both look the same, sometimes it creates confusion in the readers' mind. Let us give brief idea about copyright and trademark and difference between themCopyrightThe main objective of copyright is to protect the artist's original work. Work may be a photo, book, painting, software code; article etc. copyright gives the owner a right to reproduce their work or profit off their underlying work.The principle involved is pretty simple "if you create something new or original work, you have to choose what to do". To get the copyrights you have to register first ...
Read MoreExplain various types of intellectual properties
The term property means an individual or an organization owns it and it is protected by means of law. Intellectual properties are intangible assets of a business or a person. It can be a book, article in a magazine, a new design etc. which comes under intellectual properties.TypesThe types of intellectual properties are explained follows −PatentsA patent protects innovative ideas. It gives special rights to the respective owner/organization in making, selling and using the product or service period. A government authority or license conferring a right will be issued. An individual or an organization will approach the patent authority, submit ...
Read More