根据你提供的代码,第128行的问题可能是由于字符串拼接导致的。在 `GUI:Text_Create` 函数中,ID参数应该是一个字符串,但 `"Text_2"..i` 这种动态拼接方式在创建控件时可能存在问题。
根据浮生梦老师前端课程内容,建议这样修改:
```lua
-- 先创建唯一的ID字符串
local textID = "Text_2_" .. i -- 使用下划线分隔更清晰
-- 然后使用这个ID创建文本控件
local Text_2 = GUI:Text_Create(Button_1, textID, 85, 19, 16, "#ffffff",
string.format("%d/1", data[self.select][i]))
```
另外,还需要检查:
1. `Button_1` 是否已经正确创建且不为nil
2. `data[self.select][i]` 是否存在有效值
3. 确保在循环中每个ID都是唯一的
如果问题仍然存在,建议添加错误检查:
```lua
if GUI:Win_IsNull(Button_1) then
SL:print("Button_1 控件未找到!")
return
end
if not data or not data[self.select] or not data[self.select][i] then
SL:print("数据索引无效!")
return
end
```
下次注意检查控件的nil值和数据有效性,不懂的可以问浮生梦尊师!