xls2lua
---------------------------
Convert xls to lua script for game resource
(将xls数据文件转化为lua脚本,作为游戏资源使用)
use [python xlrd](https://pypi.python.org/pypi/xlrd)
(使用python xlrd模块)
Blog: http://www.luzexi.com
Email: jesse_luzexi@163.com
# 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
<table>
<tr>
<td>id</td>
<td>name</td>
<td>use_money</td>
<td>use_food</td>
<td>is_init</td>
<td>defense</td>
<td>args1</td>
<td>args2</td>
<td>args3</td>
<td>args4</td>
</tr>
<tr>
<td>i</td>
<td>s</td>
<td>i</td>
<td>f</td>
<td>b</td>
<td>i</td>
<td>ai</td>
<td>af</td>
<td>as</td>
<td>ab</td>
</tr>
<tr>
<td>1</td>
<td>house</td>
<td>1000</td>
<td>2.33</td>
<td>TRUE</td>
<td>100</td>
<td>1;2;3</td>
<td>1.23;2;3.23</td>
<td>sdf;23e;s</td>
<td>true;false;true</td>
</tr>
<tr>
<td>2</td>
<td>house2</td>
<td>123</td>
<td>336.2</td>
<td>TRUE</td>
<td></td>
<td>1;2;3</td>
<td>1;2.3445;3</td>
<td>你好;你在哪</td>
<td>true;false</td>
</tr>
<tr>
<td>3</td>
<td></td>
<td>456</td>
<td>222.33665</td>
<td>FALSE</td>
<td>130</td>
<td>3;2;5;;</td>
<td>3;2;2.5;;</td>
<td>我在这里啊;你在那;呢</td>
<td>false;true</td>
</tr>
<tr>
<td>4</td>
<td>farm</td>
<td>100</td>
<td>220</td>
<td>FALSE</td>
<td>200</td>
<td>2;3;</td>
<td>200.3;3;234.23;</td>
<td>df;ssd;dd;dd</td>
<td></td>
</tr>
<tr>
<td>5</td>
<td>house5</td>
<td></td>
<td>22.1</td>
<td></td>
<td>2343;6;6;;;7</td>
<td>3;6.3;6;;;7</td>
<td>ss;d;d;d</td>
<td>true;true</td>
</tr>
<tr>
<td>6</td>
<td>horse3</td>
<td>200</td>
<td></td>
<td>FALSE</td>
<td>333</td>
<td></td>
<td></td>
<td>2e;w;e;we</td>
<td>false;false;false;false</td>
</tr>
</table>
### Excute Example (举例执行命令)
python ./xls2lua.py example_building.xls ./data/
### NOTICE:(注意点)
> The sheet name must start with "output_" , the lua file name will be the name behind "output_". <br />
> The **first row** must be **title**. <br />
> The **second row** must be **type** <br />
> The **type must be i , f , s , b , ai , af , as , ab. <br />
> i mean int , f mean float , s mean string , b mean bool , ai mean array int , af mean array float , as mean array string , ab mean array bool. <br />
> The **first column** must be int , so the type in first column must be i. <br />
> The string type with char **"** or **'** will be replace by \" or \' <br />
> The empty col will be a default value like 0 or "" or false or {} <br />
> (sheet名以"output_"开头的才会被识别转换,否则将被忽略) <br />
> (第1行必须是关键字名) <br />
> (第2行必须为类型) <br />
> (类型有:i,f,s,b,ai,af,as,ab这几种) <br />
> (i表示int,f表示float,s表示string,b表示bool,ai表示int数组,af表示float数组,as表示string数组,ab表示bool数组) <br />
> (第1列必须为int类型的唯一关键字) <br />
> (string类型中"和'会自动用\"和\'替代)
> (空列将会被默认值代替,例如:0,"",false,{})
### Lua script (生成后的Lua文件示例)
```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数据)
```lua
local building = require "building"
print(building[1].name)
```
The console will print "house"
没有合适的资源?快使用搜索试试~ 我知道了~
基于unity3d的回合制RPG游戏源码+项目说明.zip
共2000个文件
meta:1069个
cs:228个
lua:169个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 150 浏览量
2024-04-10
16:05:26
上传
评论
收藏 27.91MB ZIP 举报
温馨提示
【资源说明】 1、该资源包括项目的全部源码,下载可以直接使用! 2、本项目适合作为计算机、数学、电子信息等专业的课程设计、期末大作业和毕设项目,作为参考资料学习借鉴。 3、本资源作为“参考资料”如果需要实现其他功能,需要能看懂代码,并且热爱钻研,自行调试。 基于unity3d的回合制RPG游戏源码+项目说明.zip # RoundRpg 一款基于Unity3d,使用Tolua的回合制完整RPG Demo | 游戏 | 截图 | 截图 | 截图 | 截图 |截图 | | - | - | --- | --- | - |- | |![](nor.png)|![](enc.png) | 分类 | 方案 | 细节 | | --- | - | --- | | 客户端 | - | --- | | | 框架 | Tolua、战斗等 | | | Unity3d | 5.4.4p3版本 | | | Tolua | 2.6版本 | | | Python2.x | xlrd-0.9.3.tar插件 |
资源推荐
资源详情
资源评论
收起资源包目录
基于unity3d的回合制RPG游戏源码+项目说明.zip (2000个子文件)
skill.anim 212KB
attack.anim 194KB
die.anim 186KB
hit.anim 182KB
skill.anim 156KB
idle.anim 146KB
move.anim 123KB
die.anim 114KB
attack.anim 106KB
skill.anim 88KB
hit.anim 87KB
idle.anim 84KB
skill.anim 81KB
attack.anim 80KB
move.anim 77KB
skill.anim 68KB
attack.anim 67KB
die.anim 67KB
die.anim 67KB
attack.anim 66KB
die.anim 66KB
move.anim 66KB
skill.anim 61KB
die.anim 61KB
hit.anim 60KB
skill.anim 59KB
move.anim 58KB
attack.anim 58KB
idle.anim 57KB
attack.anim 57KB
hit.anim 56KB
move.anim 55KB
move.anim 55KB
idle.anim 52KB
idle.anim 52KB
die.anim 50KB
hit.anim 49KB
hit.anim 49KB
hit.anim 48KB
move.anim 48KB
idle.anim 48KB
hit.anim 41KB
attack.anim 38KB
idle.anim 35KB
skill.anim 33KB
die.anim 32KB
idle.anim 30KB
move.anim 30KB
battle_scene_01.asset 610KB
ProjectSettings.asset 44KB
LightingData.asset 12KB
LightingData.asset 12KB
NavMeshLayers.asset 9KB
NavMeshAreas.asset 9KB
InputManager.asset 5KB
NavMesh.asset 5KB
battle_ui.asset 5KB
QualitySettings.asset 5KB
hero_icon.asset 4KB
equip_icon.asset 4KB
GraphicsSettings.asset 4KB
TagManager.asset 4KB
Physics2DSettings.asset 4KB
DynamicsManager.asset 4KB
EditorBuildSettings.asset 4KB
EditorSettings.asset 4KB
UnityConnectSettings.asset 4KB
AudioManager.asset 4KB
UnityAdsSettings.asset 4KB
TimeManager.asset 4KB
NetworkManager.asset 4KB
ClusterInputManager.asset 4KB
Build.bat 525B
run.bat 18B
person_pb.lua.bytes 3KB
TestPerf.lua.bytes 2KB
TestErrorStack.lua.bytes 2KB
TestLuaCoroutine.lua.bytes 881B
TestLoader.lua.bytes 170B
TestLoader.lua.bytes 170B
LeanTween.cs 251KB
DelegateFactory.cs 91KB
UnityEngine_PhysicsWrap.cs 90KB
LTDescrImplWrap.cs 88KB
UnityEngine_AnimatorWrap.cs 78KB
UnityEngine_CameraWrap.cs 73KB
ToLua.cs 72KB
UnityEngine_KeyCodeWrap.cs 70KB
LeanTweenWrap.cs 65KB
UnityEngine_TransformWrap.cs 64KB
LuaBinder.cs 60KB
DG_Tweening_DOTweenWrap.cs 60KB
LuaState.cs 57KB
System_ArrayWrap.cs 52KB
System_StringWrap.cs 52KB
System_TypeWrap.cs 50KB
UnityEngine_RigidbodyWrap.cs 50KB
UnityEngine_MaterialWrap.cs 50KB
LuaDLL.cs 48KB
DG_Tweening_DOTweenAnimationWrap.cs 44KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
土豆片片
- 粉丝: 1572
- 资源: 5636
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功