We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
`
func (self *luaTable) _shrinkArray() { for i := len(self.arr) - 1; i >= 0; i-- { if self.arr[i] == nil { self.arr = self.arr[0:i] } else { break //应该是需要break??? } } } `
The text was updated successfully, but these errors were encountered:
我也是看到这里一直想不明白,应该要break才对,求作者大大解答一下 @zxh0
Sorry, something went wrong.
谢谢反馈,最好能写一个Lua脚本对比一下CLua和本书实现的差别😊
您好,我用的测试脚本如下:
tb = {"a", "b", "c", "d", "e"} tb[3] = nil tb[5] = nil print(tb[4])
在CLua中运行,可以得到正确结果tb[4]是 “d” 但用书中的代码,tb[4]是nil,在Shrink后的结果中被丢掉了
@qazwsxedc121 收到,我会尽快处理一下
@taoistcard @qazwsxedc121 已经提交了fix,非常感谢
No branches or pull requests
`
func (self *luaTable) _shrinkArray() {
for i := len(self.arr) - 1; i >= 0; i-- {
if self.arr[i] == nil {
self.arr = self.arr[0:i]
} else {
break //应该是需要break???
}
}
}
`
The text was updated successfully, but these errors were encountered: