I really want to save some non-essential information in the tab table format to the client to reduce the communication with the server and reduce the pressure. So I wrote this one.
But because of this, it is necessary to detect the synchronization of these data every time you log in, which slows down the landing speed and is not used.
I think that after the server pressure increases later, you can use this.
1 --2 --Created by IntelliJ.3 --User:elan4 --date:15-7-15 pm 12:145 --To change this template use File | Settings | File Templates.6 --7 LocalTabreader = Class ("Tabreader")8 9 functionTabreader:ctor ()Ten End One A functionTabreader:Load(filename) -Self.fn =filename - the LocalFile =Io.open(Self.fn,"RB") - if notFile Then - Print("File not exist", Self.fn) - return false + End - + Localstr =File:read("*all") A Io.close(file) at - returnself:parse (str) - End - - functiontabreader:parse (str) - LocalContent = {} in LocalList = String.Split (str,"\ r \ n") - to if#list <=1 Then + returncontent - End the * Table.remove(List,1)--The first line is the description of each field $ Panax Notoginseng fori =1, #list Do - Localline =String.ltrim (List[i]) the if string.sub(Line,1,1) ~="#" Then --#开头的行为注释行 + Localrows = String.Split (line,"\ t") AContent[content +1] =rows the End + End - $ returncontent $ End - - returnTabreader
Read Tab table in LUA