local IconData = {
{
{notes="在线充值按钮",path="res/custom/top/11.png"},
{notes="狂暴之力按钮",path="res/custom/top/12.png"},
},
{
{notes="每日礼包按钮",path="res/custom/top/21.png"},
{notes="七日签到按钮",path="res/custom/top/22.png"},
},
{
{notes="浓情端午按钮",
🤖 回答引擎: 前端Lua |
🕒 时间: 2026-04-17 14:24:30 |
👁️ 阅读: 3
在Lua中,你可以使用`table.insert`函数来向表中插入数据。以下是几种插入方式:
1. **向一级数组末尾插入一个新的一级子表**:
```lua
table.insert(IconData, {
{notes="新按钮1", path="res/custom/top/41.png"},
{notes="新按钮2", path="res/custom/top/42.png"}
})
```
2. **向指定的一级子表中插入新的按钮数据**(比如向第二个子表插入):
```lua
table.insert(IconData[2], {notes="新增按钮", path="res/custom/top/23.png"})
```
3. **向指定位置插入**(在第二个位置插入新的一级子表):
```lua
table.insert(IconData, 2, {
{notes="中间插入按钮组", path="res/custom/top/new.png"}
})
```
这样操作后,`IconData`的结构就会按照你的需求更新了。
← 返回问答库