Eclipse中安装Lua开发插件,很简单,只要如下几个步骤就好~
安装步骤
- Help -> EclipseMarketplace
搜索框输入“lua”查找插件~
- 点击“Install”按钮,进行安装
- 点击“Confirm”按钮,进行确认
选择“I accept the terms of the license agreement”,并点击“Finish”按钮
点击“Yes”重启
编写Lua脚本程序
新建Lua工程
执行上述的安装Lua插件以后,新建工程可以看到“Lua”相关选项~
编写Lua简单示例
local function main() local message = "Welcome to Lua world~"; print(message); local books = {"NoSQL实践指南","Java安全编码标准"}; local startIndex = 1; local endIndex = table.getn(books); for i= startIndex, endIndex do print(books[i]) end local isCompleted = true; print(type(isCompleted)); print(isCompleted); local filename = "filetest.txt"; file = io.open("filetest.txt", "w+"); file:write("文件末尾注释"); file:flush(); file:close(); endmain()
运行程序~
输出结果:
Welcome to Lua world~NoSQL实践指南Java安全编码标准booleantrue
至此,表明Eclipse安装Lua开发工具插件已经完成,并可用~