1 Install development plug-in
Install Lua's development plug-in EmmyLua in idea or vscode
2 Create project
Create a new project in idea
Select Lua as the type of project
Enter the project name and target directory
Set the local installation directory of Lua in the SDK of the project structure
Select lua in the modules of the project structure
3 Write the first lua program
Add the program package under the project and create the Lua program file. It should be noted that New Lua File should be selected here.
Enter the following code in the file
print("你好, Lua!")
4 Execute program
Right click on the above program and execute
If the above error occurs, it means that the executable file of Lua is different from the default lua.exe in idea, and the execution parameters need to be modified.
Click Configuration Edit in the upper right corner
Modify the program content to have the same name as the actual executable file, here it is lua53.exe
After modification, save and re-execute, you can see the following output
lua53.exe com/study/lua/HelloLua.lua
Hello, Lua!
At this point, the Lua program development environment is set up!