|
|
||
|
I think it just tell you no element been removed , you should stop to call remove again by in loop, You can check returned value is nil to know index is invalid without triggering an error. 发件人: <[email protected]> 代表 yan jun <[email protected]> here is a sample: --==================================================== t = {1} table.remove(t,2) --no error, return nil table.remove(t,3) --throw an error: "position out of bounds" --==================================================== "table.remove" is implemented by "tremove" in C, and here is the code about "tremove" in lua5.3: /*===================================================== static int tremove (lua_State *L) { /*===================================================== I am curious about that why "size + 1" is the validate position? Does the positon length+1 has a special meaning? thanks everybody! |