mirror of
https://github.com/wxd-gaming/test-all.git
synced 2026-05-08 14:36:26 +08:00
86 lines
1.9 KiB
Lua
86 lines
1.9 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
|
|
|
|
LoginEventListerTable:eventLister("0", "test", function()
|
|
print("test")
|
|
end, 999999)
|
|
|
|
LoginEventListerTable:eventLister("0", "test", this.t1)
|
|
|
|
LoginEventListerTable:eventLister("0", "test", function()
|
|
print("test100")
|
|
end, 100)
|
|
|
|
LoginEventListerTable:eventLister("0", "test", function()
|
|
print("test1")
|
|
end, 1)
|
|
|
|
LoginEventListerTable:triggerEvent("0")
|
|
|
|
local a = 10
|
|
print(a < 20 and a or 20)
|
|
|
|
gameDebug.debug(function()
|
|
CheckOpenEventListerTable:eventLister("0", "会员礼包检测", function()
|
|
return "CheckOpenEventListerTable"
|
|
end)
|
|
|
|
print(CheckOpenEventListerTable:triggerResult("0"))
|
|
end)
|
|
|
|
local tmpList = {}
|
|
|
|
for i = 1, 10 do
|
|
table.insert(tmpList, tostring(i))
|
|
end
|
|
|
|
gameDebug.print(tmpList)
|
|
|
|
table.remove(tmpList, 5)
|
|
|
|
gameDebug.print(tmpList) |