当前位置:网站首页>Configuration file converted from Excel to Lua
Configuration file converted from Excel to Lua
2022-07-06 05:10:00 【Handsome_ shuai_】
Excel Convert to Lua Configuration file for
1. download Excel turn Lua Third party library
First, we download a third-party open source library , Here it is Excel Table to generate lua The configuration file , Download address https://github.com/XINCGer/Unity3DTraining/tree/master/XlsxTools
2. Prepare to build Lua The configuration file
- Follow Assets Under the same level directory , Create a new one Tools Folder , Then download the XlsxTools Put the folder here
- And then in debug Compile this solution in mode

There are several points to note in this document :
excel The file must be saved as .xls Format , instead of .xlsx Format
Lower left corner tab The tab name must be the same as the file name , And add a # Prefix , Like my one CharacterTable file ,tab The tab name is #CharacterTable
excel Before 4 Line has special meaning :
The first 1 The row is the name description of each field
The first 2 Row is the variable type of each field , Generally only support int and string type
The first 3 Row is the variable name of each field , This variable name can be used directly in code
The first 4 Line is comment , You can explain the meaning of this field in detail

And the most important point : The first field must be int type , And the variable name must be Id
- To configure .ini file , Set up Excel Read and output paths
- Next , We are Tools Create a new folder ExcelToLua.bat file , Used to automatically Excel The file generates the corresponding lua file
cd ./XlsxTools/Xls2Lua/Xls2Lua/bin/Debug/
Xls2Lua ^
pause
Double click Run to generate Lua The configuration file
3. Use Lua The configuration file
- establish ExcelMgr To manage all lua The configuration file
ExcelMgr = {
}
-- Excel Table manager
ExcelMgr.CacheTable = {
}
ExcelMgr.CacheTableRow = {
}
function ExcelMgr:GetTable(tableName)
local oneTable = self.CacheTable[tableName]
if oneTable ~= nil then
return oneTable
end
oneTable = require(tableName)
self.CacheTable[tableName] = oneTable
return self.CacheTable[tableName]
end
function ExcelMgr:GetRow(tableName, id)
if self.CacheTableRow[tableName] == nil then
local oneTable = self:GetTable(tableName)
self.CacheTableRow[tableName] = {
}
for _,v in ipairs(oneTable) do
self.CacheTableRow[tableName][v.Id]= v
end
end
if self.CacheTableRow[tableName] then
return self.CacheTableRow[tableName][id]
end
end
return ExcelMgr
边栏推荐
- Application of Flody
- The IPO of mesk Electronics was terminated: Henan assets, which was once intended to raise 800 million yuan, was a shareholder
- JS quick start (II)
- Hyperledger Fabric2. Some basic concepts of X (1)
- Crazy God said redis notes
- Codeforces Round #804 (Div. 2)
- 【OSPF 和 ISIS 在多路访问网络中对掩码的要求】
- 關於Unity Inspector上的一些常用技巧,一般用於編輯器擴展或者其他
- Hometown 20 years later (primary school exercises)
- TCP three handshakes you need to know
猜你喜欢

Implementing fuzzy query with dataframe

Principle and performance analysis of lepton lossless compression

麥斯克電子IPO被終止:曾擬募資8億 河南資產是股東

JS quick start (II)

Crazy God said redis notes

Acwing week 58
![[mathematical modeling] differential equation -- sustainable development of fishing industry](/img/7c/2ab6f2a34bc2c97318537ec8e0b0c5.png)
[mathematical modeling] differential equation -- sustainable development of fishing industry

Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example

Codeforces Round #804 (Div. 2)

Fiddler installed the certificate, or prompted that the certificate is invalid
随机推荐
Set detailed map + interview questions
Postman前置脚本-全局变量和环境变量
Crazy God said redis notes
[noip2008 improvement group] stupid monkey
Mysql高级篇学习总结9:创建索引、删除索引、降序索引、隐藏索引
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
你需要知道的 TCP 三次握手
Idea one key guide package
Biscuits (examination version)
Mongodb basic knowledge summary
[mathematical modeling] differential equation -- sustainable development of fishing industry
驱动开发——HelloWDM驱动
Realize a binary read-write address book
[leetcode daily question] number of enclaves
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Redis has four methods for checking big keys, which are necessary for optimization
RTP gb28181 document testing tool
ISP learning (2)
Please wait while Jenkins is getting ready to work
Some common skills on unity inspector are generally used for editor extension or others