在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):luzexi/xls2lua开源软件地址(OpenSource Url):https://github.com/luzexi/xls2lua开源编程语言(OpenSource Language):Python 83.4%开源软件介绍(OpenSource Introduction):xls2luaConvert xls to lua script for game resource (将xls数据文件转化为lua脚本,作为游戏资源使用) use python xlrd (使用python xlrd模块) Blog: http://www.luzexi.com Email: [email protected] What's this.(是什么)This is a script to convert xls to lua. If you use lua language , the data write in lua is the best thing for you to code. So this script will help you convert xls to lua , so you can do your job more easily. (如果你在使用Lua语言,将数据写进Lua文件是最方便的做法。这个脚本将帮助你将数据xls文件转化为lua文件,这样你就可以更好的工作了。) Declare (声明)This script is inherit from https://github.com/zfengzhen/xls2lua . I improve it to fit my data rule like add array type in script and remove the different talbe name in xls and so on. Any way , you can choose one that more fit your project. (这个脚本是从 https://github.com/zfengzhen/xls2lua 继承过来的,我改进了很多东西,也去除了很多东西,我改成了适合我自己的脚本。不管怎样,你可以选择一个适合你的脚本去运行。) Example(例子xls表格)example_building.xls
Excute Example (举例执行命令)python ./xls2lua.py example_building.xls ./data/ NOTICE:(注意点)
Lua script (生成后的Lua文件示例)-- this file is generated by program!
-- don't change it manaully.
-- source file: example_building.xls
-- created at: Thu Mar 26 02:53:52 2015
local data = {}
data[1] = { id = 1, name = "house", use_money = 1000, use_food = 2.33, is_init = true, defense = 100, aadd = {1,2,3}, aadddss = {1.23,2,3.23}, ddff = {"sdf","23e","s"}, ffdd = {true,false,true}}
data[2] = { id = 2, name = "house2", use_money = 123, use_food = 336.2, is_init = true, defense = 0, aadd = {1,2,3}, aadddss = {1,2.3445,3}, ddff = {"你好","你在哪"}, ffdd = {true,false}}
data[3] = { id = 3, name = "", use_money = 456, use_food = 222.33665, is_init = false, defense = 130, aadd = {3,2,5}, aadddss = {3,2,2.5}, ddff = {"我在这里啊","你在那","呢"}, ffdd = {false,true}}
data[4] = { id = 4, name = "farm", use_money = 100, use_food = 220.0, is_init = false, defense = 200, aadd = {2,3}, aadddss = {200.3,3,234.23}, ddff = {"df","ssd","dd","dd"}, ffdd = {}}
data[5] = { id = 5, name = "house5", use_money = 0, use_food = 22.1, is_init = false, defense = 234, aadd = {3,6,6,7}, aadddss = {3,6.3,6,7}, ddff = {"ss","d","d","d"}, ffdd = {true,true}}
data[6] = { id = 6, name = "horse3", use_money = 200, use_food = 0, is_init = false, defense = 333, aadd = {}, aadddss = {}, ddff = {"2e","w","e","we"}, ffdd = {false,false,false,false}}
return data
How to use lua with data. (如何使用生成的lua数据)local building = require "building"
print(building[1].name) The console will print "house" |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论