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
--base64加密 | |
function base64_encode(data) | |
local base64Table='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' | |
return ((data:gsub('.', function(x) | |
local r,b='',x:byte() | |
for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end | |
return r; | |
end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x) | |
if (#x < 6) then return '' end | |
local c=0 |
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
table.tostring = function(t) | |
if t==nil then | |
return "error,print table is nil!" | |
end | |
local assign={} | |
local function ser_table(tbl,parent) | |
local tmp={} | |
for k,v in pairs(tbl) do | |
local key= type(k)=="number" and "["..k.."]" or "[".. string.format("%q", k) .."]" | |
if type(v)=="table" then |
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
------------------------------chinesePhoneticData.lua | |
local hash = {}; | |
hash = { | |
["中"] = "Zhong"; | |
["国"] = "Guo"; | |
["股"] = "Gu"; | |
["票"] = "Piao"; | |
["名"] = "Ming"; | |
["称"] = "Cheng"; |
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
g_HashTable = 0 | |
--创建hash表 | |
function createHashTable() | |
local tb = {}; | |
local _insert = function(k,v) | |
if k==0 then | |
k=1; | |
end | |
for i = k,k+999,1 do | |
if i>1000 then |