{"id":12760,"date":"2019-03-28T18:58:09","date_gmt":"2019-03-28T18:58:09","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=12760"},"modified":"2019-03-28T18:58:09","modified_gmt":"2019-03-28T18:58:09","slug":"how-to-install-lua-scripting-language-in-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/28\/how-to-install-lua-scripting-language-in-linux\/","title":{"rendered":"How to Install Lua Scripting Language in Linux"},"content":{"rendered":"<p><strong>Lua<\/strong>\u00a0is a free and open source, powerful, robust, minimal and embeddable scripting language. It\u2019s an extensible and interpreted scripting languages that is dynamically typed, run by interpreting bytecode with a register-based virtual machine.<\/p>\n<p>Lua runs on all if not most Unix-like operating systems including Linux and Windows; on mobile operating systems (Android, iOS, BREW, Symbian, Windows Phone); on embedded microprocessors (ARM and Rabbit); on IBM mainframes and many more.<\/p>\n<p>See how\u00a0<strong>Lua<\/strong>\u00a0programs works in the\u00a0<a href=\"https:\/\/www.lua.org\/demo.html\" target=\"_blank\" rel=\"nofollow noopener\">live demo<\/a>.<\/p>\n<h4>Lua Features:<\/h4>\n<ul>\n<li>Builds on all systems with a standard C compiler.<\/li>\n<li>It\u2019s remarkably lightweight, fast, efficient and portable.<\/li>\n<li>It\u2019s easy to learn and use.<\/li>\n<li>It has a simple and well documented API.<\/li>\n<li>It supports several types of programming (such as procedural, object-oriented, functional and data-driven programming as well as data description).<\/li>\n<li>Implements object-oriented via meta-mechanisms.<\/li>\n<li>It also brings together straightforward procedural syntax with formidable data description constructs rooted around associative arrays and extensible semantics.<\/li>\n<li>Comes with automatic memory management with incremental garbage collection (thus making it perfect for real-world configuration, scripting, and also breakneck prototyping).<\/li>\n<\/ul>\n<h3>How to Install Lua in Linux<\/h3>\n<p><strong>Lua<\/strong>\u00a0package is available in official repositories of major Linux distributions, you can install the latest version using the appropriate package manager on your system.<\/p>\n<pre>$ sudo apt install lua5.3\t                #Debian\/Ubuntu systems \r\n# yum install epel-release &amp;&amp; yum install lua\t#RHEL\/CentOS systems \r\n# dnf install lua\t\t                #Fedora 22+<\/pre>\n<p><strong>Note:<\/strong>\u00a0The current version of Lua package in EPEL repository is 5.1.4; therefore to install the current release, you need to build and install it from source as explained below.<\/p>\n<h4>Install Lua from Sources<\/h4>\n<p>First, ensure that you have development tools installed on your system, otherwise run the command below to install them.<\/p>\n<pre>$ sudo apt install build-essential libreadline-dev      #Debian\/Ubuntu systems \r\n# yum groupinstall \"Development Tools\" readline\t\t#RHEL\/CentOS systems \r\n# dnf groupinstall \"Development Tools\" readline\t\t#Fedora 22+\r\n<\/pre>\n<p>Then to build and install the latest release (version\u00a0<strong>5.3.4<\/strong>\u00a0at the time of this writing) of Lua, run the following commands to download the package tar ball, extract, build and install it.<\/p>\n<pre>$ mkdir lua_build\r\n$ cd lua_build\r\n$ curl -R -O http:\/\/www.lua.org\/ftp\/lua-5.3.4.tar.gz\r\n$ tar -zxf lua-5.3.4.tar.gz\r\n$ cd lua-5.3.4\r\n$ make linux test\r\n$ sudo make install\r\n<\/pre>\n<p>Once you have installed it, run\u00a0<strong>Lua<\/strong>\u00a0interpretor as shown.<\/p>\n<pre>$ lua \r\n<\/pre>\n<div id=\"attachment_30132\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/07\/Lua-Interpretor.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30132\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/07\/Lua-Interpretor.png\" alt=\"Lua Interpretor\" width=\"535\" height=\"82\" aria-describedby=\"caption-attachment-30132\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-30132\" class=\"wp-caption-text\">Lua Interpretor<\/p>\n<\/div>\n<p>Using your favorite text editor, you can create your first\u00a0<strong>Lua<\/strong>\u00a0program as follows.<\/p>\n<pre>$ vi hello.lua\r\n<\/pre>\n<p>And add the following code to the file.<\/p>\n<pre>print(\"Hello World\")\r\nprint(\"This is Tecmint.com and we are testing Lua\")\r\n<\/pre>\n<p>Save and close the file. Then run your program as shown.<\/p>\n<pre>$ lua hello.lua\r\n<\/pre>\n<div id=\"attachment_30131\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/07\/run-lua-program.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30131\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/07\/run-lua-program.png\" alt=\"Run Lua Program\" width=\"612\" height=\"78\" aria-describedby=\"caption-attachment-30131\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-30131\" class=\"wp-caption-text\">Run Lua Program<\/p>\n<\/div>\n<p>For more information and to learn how to write Lua programs, go to:\u00a0<a href=\"https:\/\/www.lua.org\/home.html\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/www.lua.org\/home.html<\/a><\/p>\n<p><strong>Lua<\/strong>\u00a0is a versatile programming language being used in numerous industries (from web to gaming to image processing and beyond), and it\u2019s designed with a high priority for embedded systems.<\/p>\n<p>If you encounter any errors during installation or simply want to know more, use the comment form below to send us your thoughts.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/install-lua-in-centos-ubuntu-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lua\u00a0is a free and open source, powerful, robust, minimal and embeddable scripting language. It\u2019s an extensible and interpreted scripting languages that is dynamically typed, run by interpreting bytecode with a register-based virtual machine. Lua runs on all if not most Unix-like operating systems including Linux and Windows; on mobile operating systems (Android, iOS, BREW, Symbian, &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/28\/how-to-install-lua-scripting-language-in-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Install Lua Scripting Language in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12760","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=12760"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12760\/revisions"}],"predecessor-version":[{"id":12761,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12760\/revisions\/12761"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=12760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=12760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=12760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}