local propertyTable = { RightsID = 1,Name = 2,GradeID = 3,UnlockDes = 4,Picture = 5,Summary = 6,FunctionDes = 7,UseTimesDes = 8,UsedTimesDes = 9,UseTimes = 10,UsedTimes = 11,IfUse = 12,Parm = 13,ItemID = 14,Scope = 15,Lower = 16,BuffID = 17,UseRecord = 18,UsedRecord = 19,IfShow = 20, } local mainPropertyTable = { RightsID = 1,PageIndex = 2,LineIndex = 3, } local primaryTable = { "RightsID", } 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/OfficialRights-page'..pageIndex) if DataSheetUtil then --skip fixedpoint process for data sheet checker DataSheetUtil.ProcessFixedPoint('OfficialRights', 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), setmetatable({2,1,2},base), setmetatable({3,1,3},base), setmetatable({4,1,4},base), setmetatable({5,1,5},base), } return { dataTable = dataTable, propertyTable = propertyTable, primaryTable = primaryTable, }