Install the lua language in ubuntu and the lua language in ubuntu.

Source: Internet
Author: User

Install the lua language in ubuntu and the lua language in ubuntu.

Preface:

The lua scripting language is also the first touch. the previously used scripting language only has python. After reading some introductions of lua, I feel that this scripting language is more concise than python, although there are not so many standard libraries that can be supported by python, its flexibility and scalability make this scripting language have a foothold. Particularly in the gaming field, lua's status is really unusual.

My system is Ubuntu14.04, and the Environment is

Linux version 3.13.0-29-generic (buildd@toyol) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #53-Ubuntu SMP Wed Jun 4 21:00:20 UTC 2014

Today, I am interested in learning about lua development, which is of great help to mobile games.

1. Build a Development Environment

Building an environment before development is essential. For linux users, you can simply use a line of command to install lua on the terminal. However, the installation of lua may cause some problems for the embedding of C or C ++, some files cannot be found.

Therefore, you need to download the lua source code on the official website and then install it.

You can find the following version information on the official website or directly enter the lua official website.


I downloaded the version 5.1.5. After downloading the source code file, decompress it to a folder and enter the path to the extracted file from the terminal. This is the information in my folder.


The Makefile folder is displayed and runs directly on the terminal.

<span style="font-size:24px;">make linux</span>

2. Problems Encountered

1) The readline. h file cannot be found.

Some problems may occur when executing this command. The first problem is that the readline. h file cannot be found.

error:readline/readline.h:no such file or directory 
Solution: Install apt-file, which is a software package search tool. You can find the files contained in the software package and the installation location.

Enter:

sudo apt-get install apt-file  
Then enter:

sudo apt-file update  
At this time, apt-file is installed, and the libreadline library is installed at this time.

sudo apt-get install libreadline-dev
After libreadline is installed, run the make linux Command to solve the problem.

2) The-lncurses file is not found.

However, another problem occurs, prompting that the file-lncurses cannot be found.

/usr/bin/ld: cannot find -lncurses
Solution

Input on the terminal

sudo apt-cache search ncurses- | grep ^libncurses
You will see information about a libncurses5-dev, as shown below


Install the libncurses5-dev directly on the terminal at this time

sudo apt-get install libncurses5-dev
The following interface indicates that the installation is complete.


At this time, execute the make linux Command to compile the lua file. below is the compiled information.


After compilation, you can enter

make install
Command to install lua. The installation information is as follows:


At this time, it indicates that lua has been installed in your system and is directly entered in the command line.

lua test/hello.lua
Test whether the installed lua can be run.

All the work here is OK, so you can start your lua learning journey.

For me, the main purpose of using the lua language is to embed it into C or C ++ code to make program development or modification simpler and give full play to the scalability of the lua language.



How do I set the system language in ubuntu?

1. Set the software source to ensure that the software can be updated. If not, modify sources. list and use the following two commands.
Sudo cp/etc/apt/sources. list/etc/apt/sources. list_backup (there are spaces after sudo, cp and sources. list, which is the original backup source list)
Sudo gedit/etc/apt/sources. list (this is the source list for editing, and fill in the appropriate software source address)
2. update it.
Sudo apt-get update (update package list)
3. Open the "language support" dialog box. Choose System> System Management> language support from the main menu )".
In the "Supported languages" list, find "Chinese" and tick it on the right side. Change the default language to "Chinese", select Enable support to enter complex characters, and click OK.
Ubuntu will download and install the Language Pack. After the installation is complete, log out and log on again. The interface becomes Chinese.

Chinese Language Pack cannot be installed in Ubuntu

This is because you didn't select a software source.

Take 8.04 as an example:

Select a Chinese software source. Choose system-preference-software source from China (select any of the three)
Then click update (sudo apt-get update)
This will search for new updates without downloading
Then go to Language Support and find the Chinese check point.
Download about 20 mb of things. After the installation is complete, restart it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.