-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
examples/tools/LuaProject/TablePreProcess/global_postprocess.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
15 changes: 15 additions & 0 deletions
15
examples/tools/LuaProject/TablePreProcess/preprocess_complex_test.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |