well , code is not very good, just a demo.
just to show that some codes cause luaRT to crash without any prompt.
isn't there any way to protect luaRT?
Are your sure that there are more than 7 id to get ?
no.
acturaly there are only four nodes on the chart.
and acturally it would crash just after all nodes has been found
if I add 5 nodes on the chart, then the code crash luart after 5 nodes are retrieved.
if I add 24 nodes on the chart, then the code crash luart after 24 nodes are retrieved.
I can only find the 'Next' and 'Previous' method to walk through all nodes.
the problem is , you can not use Next if you are at last position,
and you can not use Previous if you are at the beginning,
or it crash.
maybe I can count nodes first and call my code with that count specified .
end1 = chart.firstItem
► end2 = end1.next
► end3 = end2.previous
► end4 = end3.previous
crash.
► chart.ends
function
► chart.ends()
>>> bad argument #1 to 'ends' (object instance expected, got no value)
► chart:ends()
>>> COM error : unknown error
► e2 = e1.next
► e2.id
10
► e2 = e1.next
► e2.id
10
► e3 = e2.next
► e3.id
► e3
{
constructor = method
}
► e3.id == nil
true
► if e3.id then print('has id') else print('no id') end
no id
► e4 = e3.next
► e4.id
22