Skip to content

zerospace007/xlsx2lua-language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xls2lua 基于Python3.X使用 (将xlsx数据文件转化为lua脚本,作为游戏语言包使用)

use python xlrd

(使用python xlrd模块)

(如果你在使用Lua语言,将数据写进Lua文件是最方便的做法。这个脚本将帮助你将数据xls、xlsx文件转化为lua文件,这样你就可以更好的工作了。)

Excute Example (举例执行命令)

python ./xls2lua.py

NOTICE:(注意点)

(sheet名以"OUT_"开头的才会被识别转换,否则将被忽略)
(仿照词典,至少两列,一列为Key值,一列为Value值)
(可以给Value字符串传递参数,符合Lua string.format()函数使用规范,比如%s表示替换字符串,%d,%f等等)
(除前两列外其他不会写入Lua文件当中,所以可以随便注释)

Lua script (生成后的Lua文件示例)

-- This file is generated by program!
-- Don't change it manaully.
-- Author: zerospace007@163.com  NormanYang
-- Source file: LangManager.xlsx
-- Created at: Apr 2019


LangManager = {}
local this = LangManager

this["TxtStory1000"] = "二十年%s都是%d梦啊 Start"
this["TxtStory1001"] = "二十年都是梦啊 "
this["TxtStory1002"] = "二十年都是梦啊 "
this["TxtStory1003"] = "二十年都是梦啊 "
this["TxtStory1004"] = "二十年都是梦啊 "
this["TxtStory1005"] = "二十年都是梦啊 "
this["TxtStory1006"] = "二十年都是梦啊 "
this["TxtStory1007"] = "二十年都是梦啊 "
this["TxtStory1008"] = "二十年都是梦啊 "
this["TxtStory1009"] = "二十年都是梦啊 "
this["TxtStory1010"] = "二十年都是梦啊 "
this["TxtStory1011"] = "二十年都是梦啊 "
this["TxtStory1012"] = "二十年都是梦啊 "
this["TxtStory1013"] = "二十年都是梦啊 "
this["TxtStory1014"] = "二十年都是梦啊 "
this["TxtStory1015"] = "二十年都是梦啊 "
this["TxtStory1016"] = "二十年都是梦啊 "
this["TxtStory1017"] = "二十年都是梦啊 "
this["TxtStory1018"] = "二十年都是梦啊 "
this["TxtStory1019"] = "二十年都是梦啊 "
this["TxtStory1020"] = "二十年都是梦啊 "
this["TxtStory1021"] = "二十年都是梦啊 "
this["TxtStory1022"] = "二十年都是梦啊 "
this["TxtStory1023"] = "二十年都是梦啊 "
this["TxtStory1024"] = "二十年都是梦啊 "
this["TxtStory1025"] = "二十年都是梦啊 "
this["TxtStory1026"] = "二十年都是梦啊 "
this["TxtStory1027"] = "二十年都是梦啊 "
this["TxtStory1028"] = "二十年都是梦啊 "
this["TxtStory1029"] = "二十年都是梦啊 "
this["TxtStory1030"] = "二十年都是梦啊 "
this["TxtStory1031"] = "二十年都是梦啊 "
this["TxtStory1032"] = "二十年都是梦啊 "
this["TxtStory1033"] = "二十年都是梦啊 End"
this["TxtUI1000"] = "是什么东东 Start"
this["TxtUI1001"] = "是什么东东"
this["TxtUI1002"] = "是什么东东"
this["TxtUI1003"] = "是什么东东"
this["TxtUI1004"] = "是什么东东"
this["TxtUI1005"] = "是什么东东"
this["TxtUI1006"] = "是什么东东"
this["TxtUI1007"] = "是什么东东"
this["TxtUI1008"] = "是什么东东"
this["TxtUI1009"] = "是什么东东"
this["TxtUI1010"] = "是什么东东"
this["TxtUI1011"] = "是什么东东"
this["TxtUI1012"] = "是什么东东"
this["TxtUI1013"] = "是什么东东"
this["TxtUI1014"] = "是什么东东"
this["TxtUI1015"] = "是什么东东"
this["TxtUI1016"] = "是什么东东"
this["TxtUI1017"] = "是什么东东"
this["TxtUI1018"] = "是什么东东"
this["TxtUI1019"] = "是什么东东"
this["TxtUI1020"] = "是什么东东"
this["TxtUI1021"] = "是什么东东"
this["TxtUI1022"] = "是什么东东"
this["TxtUI1023"] = "是什么东东"
this["TxtUI1024"] = "是什么东东"
this["TxtUI1025"] = "是什么东东"
this["TxtUI1026"] = "是什么东东"
this["TxtUI1027"] = "是什么东东"
this["TxtUI1028"] = "是什么东东"
this["TxtUI1029"] = "是什么东东"
this["TxtUI1030"] = "是什么东东"
this["TxtUI1031"] = "是什么东东"
this["TxtUI1032"] = "是什么东东"
this["TxtUI1033"] = "是什么东东 End"
this["TxtTitle1000"] = "创建磁卡是不可借此撒 Start"
this["TxtTitle1001"] = "创建磁卡是不可借此撒"
this["TxtTitle1002"] = "创建磁卡是不可借此撒"
this["TxtTitle1003"] = "创建磁卡是不可借此撒"
this["TxtTitle1004"] = "创建磁卡是不可借此撒"
this["TxtTitle1005"] = "创建磁卡是不可借此撒"
this["TxtTitle1006"] = "创建磁卡是不可借此撒"
this["TxtTitle1007"] = "创建磁卡是不可借此撒"
this["TxtTitle1008"] = "创建磁卡是不可借此撒"
this["TxtTitle1009"] = "创建磁卡是不可借此撒"
this["TxtTitle1010"] = "创建磁卡是不可借此撒"
this["TxtTitle1011"] = "创建磁卡是不可借此撒"
this["TxtTitle1012"] = "创建磁卡是不可借此撒"
this["TxtTitle1013"] = "创建磁卡是不可借此撒"
this["TxtTitle1014"] = "创建磁卡是不可借此撒"
this["TxtTitle1015"] = "创建磁卡是不可借此撒"
this["TxtTitle1016"] = "创建磁卡是不可借此撒"
this["TxtTitle1017"] = "创建磁卡是不可借此撒"
this["TxtTitle1018"] = "创建磁卡是不可借此撒"
this["TxtTitle1019"] = "创建磁卡是不可借此撒"
this["TxtTitle1020"] = "创建磁卡是不可借此撒"
this["TxtTitle1021"] = "创建磁卡是不可借此撒"
this["TxtTitle1022"] = "创建磁卡是不可借此撒"
this["TxtTitle1023"] = "创建磁卡是不可借此撒"
this["TxtTitle1024"] = "创建磁卡是不可借此撒"
this["TxtTitle1025"] = "创建磁卡是不可借此撒"
this["TxtTitle1026"] = "创建磁卡是不可借此撒"
this["TxtTitle1027"] = "创建磁卡是不可借此撒"
this["TxtTitle1028"] = "创建磁卡是不可借此撒"
this["TxtTitle1029"] = "创建磁卡是不可借此撒"
this["TxtTitle1030"] = "创建磁卡是不可借此撒"
this["TxtTitle1031"] = "创建磁卡是不可借此撒"
this["TxtTitle1032"] = "创建磁卡是不可借此撒"
this["TxtTitle1033"] = "创建磁卡是不可借此撒  End"
this["TxtErrorCode0"] = "默认错误"
this["TxtErrorCode100"] = "登录关键字错误"
this["TxtErrorCode101"] = "账号在其他位置登录"
this["TxtErrorCode102"] = "账号在其他位置登录"
this["TxtErrorCode103"] = "账号在其他位置登录"
this["TxtErrorCode104"] = "账号在其他位置登录"
this["TxtErrorCode105"] = "账号在其他位置登录"
this["TxtErrorCode106"] = "账号在其他位置登录"

function LangManager.GetText(key, ...)
	if(this[key] ~= nil and string.len(this[key]) > 0) then
		return string.format(this[key], ...);
	end
	return key;
end

function LangManager.GetTempText(key, ...)
	return string.format(key, ...);
end

How to use lua with data. (如何使用生成的lua数据)

print(LangManager.GetText("TxtStory1000","12", 4343))

The console will print "二十年12都是4343梦啊 Start"

About

Lua Language Package

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published