LuaPre-school preparation and environment installation tutorials are the content of this article, mainly to understandLuaA pre-school guide mainly includesLuaInstall, edit, compile, and run. For details about the implementation, see this article.
Start learningLuaYou should have a general understanding of it. For the introduction of Lua language, see here.
Good English friends can also go to Lua official website to learn more, http://www.lua.orgLua official website]
This article mainly introduces preparations before learning Lua.
1) downloadLuaPackage, download page is http://www.lua.org/download.html latest version is lua-5.1.2
You can also click here to download directly: http://www.lua.org/ftp/lua-5.1.2.tar.gz it's small size, only 210 K
2) decompress the file, such as decompressing to D:/lua-5.1.2 folder in the following are taken as an example ).
3) In D:/lua-5.1.2, there is a subdirectory named/etc. Find the luavs. bat file in this directory and copy it to D:/lua-5.1.2.
4) double-click to execute the luavs. bat batch file. If the execution is successful, the luac.exe and lua.exe files will exist in the D:/lua-5.1.2/src folder.
5) add D:/lua-5.1.2/src to the system path.
6) Check whether Lua is successfully installed:
Enter lua at "start" -- "run" and press Enter. If the cmd console interface appears and contains text such as "[backcolor = rgb (255,] Lua 5.1.2, it indicates that Lua has been successfully installed. If the command is not found, check whether the luac.exe and lua.exe files exist in the D:/lua-5.1.2/src folder and make sure that the D: /lua-5.1.2/src add to system path.
7) create a simple Lua Editor:
The download page for the latest EditPlus version is http://www.onlinedown.net/soft/7116.htm.
Depending on your habits, you can select the Chinese version or the original English version. Here I will describe the original English version.
When EditPlus is installed for the first time, enter the registration code or try it for 30 days. The registration code obtained on the internet is as follows:
- Name:www.cnzz.cc
- Code:60A8E-21F10-5BZ83-ADW4E-F3TC9
My version is EditPlus 2.31 Build 524. The above registration code can be used.
After successful registration, open EditPlus, select Tools -- Preferences, select setting & syntax, click Add on the right to Add a file type, and enter Lua in the Descr partition ption column below, [backcolor = rgb (255,] fill in lua in the FIle extension column. Note that you can select Syntax File in the following column. This is where the Lua Syntax File is provided. With this feature, EditPlus can support the highlighted keyword display of lua code. This highlighted support code can be found on the Internet and made into a file with the suffix [backcolor = rgb (255,] stx.
I have uploaded the lua. stx file to the csdn resource,: http://download.csdn.net/source/257667
Select the User tools option on the left and click Add Tool -- Program on the right.
Then, enter Run_Lua in the Menu Text column.
Fill in the Command ColumnLua
Enter $ (FileName) in the Argument column)
Enter $ (FileDir) in the Initial directory column)
After changing all settings, do not forget to click [backcolor = rgb (255,] Apply application, and then click OK
Select File -- New -- Others..., select the New Lua File, and write a line of code as follows:
- print("Hello,Lua")
Save it. Select the Tools menu. The custom command Run_Lua is displayed at the bottom. Click this command to complete the execution of the lua file or press Ctrl + 1 ). The execution result is a console written with "Hello, Lua.
Now, learnLuaAfter the preparation is complete, you can start learning.
Summary: AboutLuaPre-School GuidanceLuaThe content of installation, editing, compilation, and running has been introduced. I hope this article will help you!