This is an example:
I know how to deal with this situation but I would like such method:
instead of:
The name is not a case, this was only a suggestion.
And I don't want add this method individually to every object but only to its prototype. And maybe not by me but by manufacturer to use it in further coding without requiring some package
Code:
-- WITHOUT .refresh() is:
if not objects then
objects = {'1/1/1', '1/1/2', '1/1/3', '1/1/4'}
for i=1, #objects, 1 do objects[i] = grp.find(objects[i]) end
else
for i=1, #objects, 1 do objects[i] = grp.find(objects[i].address) end
end
-- DO SOME JOB
for i=1, #objects, 1 do log(objects[i].value) end
os.sleep(300)
-- WITH .refresh() could be:
if not objects then
objects = {'1/1/1', '1/1/2', '1/1/3', '1/1/4'}
for i=1, #objects, 1 do objects[i] = grp.find(objects[i]) end
else
for i=1, #objects, 1 do objects[i]:refresh() end -- HERE IS THE DIFFERENCE
end
-- DO SOME JOB
for i=1, #objects, 1 do log(objects[i].value) end
os.sleep(300)
I know how to deal with this situation but I would like such method:
Code:
object:refresh()
instead of:
Code:
object = grp.find(object.address)
The name is not a case, this was only a suggestion.
And I don't want add this method individually to every object but only to its prototype. And maybe not by me but by manufacturer to use it in further coding without requiring some package
Done is better than perfect