Skip to content

Commit

Permalink
添加lua预处理的示例
Browse files Browse the repository at this point in the history
  • Loading branch information
821869798 committed Jun 7, 2023
1 parent 00e0861 commit c211da3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/conf/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ gen_dir = "./temp_meta"
post_process = true #导出配置的后处理开关
temp_dir = "./temp_work/temp_lua"
post_process_lua = "./tools/DataTableOptimizer.lua"
post_work_dir = "./"
post_work_dir = "./tools"
lua_win_dir = "./tools/lua5.3/lua53.exe"
lua_mac_dir = "./tools/lua5.3/lua53"

Expand Down
17 changes: 17 additions & 0 deletions examples/tools/LuaProject/TablePreProcess/global_postprocess.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@



local TablePostProcess = {}

---@class global_postprocess
--全局配置后处理,在所有配置预处理之后
local function global_postprocess(database)
--处理校验或者其他逻辑


--也可以删除包内不要的表,database.xx = nil即可(相当于仅做预处理)

end


return global_postprocess
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

local function preprocess_complex_test(data_table)
for k1,v1 in pairs(data_table) do
for k2,v2 in pairs(v1) do
v2.number = v2.number + 1
end
end

--双key结构开启这个才能支持默认值metatable
data_table.__isdoublekeydata = true

return data_table
end

return preprocess_complex_test

0 comments on commit c211da3

Please sign in to comment.