mirror of
https://github.com/wxd-gaming/test-all.git
synced 2026-05-08 06:28:01 +08:00
57 lines
1.3 KiB
Lua
57 lines
1.3 KiB
Lua
--- 数据测试
|
|
--- Generated by EmmyLua(https://github.com/EmmyLua)
|
|
--- Created by 無心道(15388152619).
|
|
--- DateTime: 2024/11/1 13:38
|
|
|
|
require("GameDebug")
|
|
require("EventLister")
|
|
|
|
tableInsert = {}
|
|
local data = {}
|
|
local dataList = {}
|
|
|
|
local function addData(id, name, index)
|
|
--if index then
|
|
-- if index < __i then
|
|
-- __i = index
|
|
-- end
|
|
--end
|
|
---- 将从k开始的所有元素向后移动
|
|
--for i = #dataList, __i, -1 do
|
|
-- dataList[i + 1] = dataList[i]
|
|
--end
|
|
local mapping = { id = id, name = name, weight = tonumber((index or 9999)) }
|
|
data[id] = mapping
|
|
table.insert(dataList, mapping)
|
|
table.sort(dataList, function(a, b)
|
|
return a.weight < b.weight
|
|
end)
|
|
end
|
|
|
|
addData("s12", "s2")
|
|
addData("s1", "s2")
|
|
addData("dste1", "s2")
|
|
addData("fs11", "我要第10", 10)
|
|
addData("s31", "s2", 998)
|
|
addData("d31", "我要第一", 2)
|
|
addData("d32", "我要第一", 1)
|
|
addData("d33", "我要第一", 1)
|
|
addData("d34", "我要第一", 1)
|
|
addData("d35", "我要第一", 1)
|
|
table.remove(dataList, 1)
|
|
--gameDebug.print("table insert ", data, dataList)
|
|
|
|
local this = {}
|
|
function this.t1()
|
|
print("this method test")
|
|
end
|
|
|
|
function this.onLogin()
|
|
print("onLogin")
|
|
end
|
|
|
|
function tableInsert.onLogin(player)
|
|
print("onLogin", player:toString())
|
|
end
|
|
|