local propertyTable = { BattlePassID = 1,GrandType = 2,GrandValue1 = 3,GrandValue2 = 4,GrandText = 5,PaidValue1 = 6,PaidValue2 = 7,IAPid1 = 8,IAPid2 = 9,MaxLevel = 10,EachLevelExp = 11,TitlePicture = 12,TitleText = 13,PaidExp1 = 14,PaidExp2 = 15,RewardDisplay1 = 16,RewardDisplay2 = 17, } local mainPropertyTable = { BattlePassID = 1,PageIndex = 2,LineIndex = 3, } local primaryTable = { "BattlePassID", } local DataPageEntry = {} local rawget = rawget local base = { __index = function(t, k) local propertyIndex = propertyTable[k] if propertyIndex then local mainPropertyIndex = mainPropertyTable[k] if mainPropertyIndex then return t[mainPropertyIndex] end local pageIndex = t[2] local pageData = DataPageEntry[pageIndex] if pageData == nil then pageData = require('Data/VersionsBattlePassData-page'..pageIndex) if DataSheetUtil then --skip fixedpoint process for data sheet checker DataSheetUtil.ProcessFixedPoint('VersionsBattlePassData', pageData) end DataPageEntry[pageIndex] = pageData end local lineIndex = t[3] local resultData = pageData[lineIndex] return resultData[propertyIndex] end end, __newindex = function() error('Attempt to modify read-only table') end } local dataTable = { setmetatable({1,1,1},base), } return { dataTable = dataTable, propertyTable = propertyTable, primaryTable = primaryTable, }