This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

:getvalue() method
#6
(06.11.2018, 14:41)buuuudzik Wrote: This is an example:
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 packageWink

Hi,
Now I better understand your aim.

B.R,
Chouaibou.
Reply


Messages In This Thread
:getvalue() method - by buuuudzik - 06.11.2018, 12:16
RE: :getvalue() method - by admin - 06.11.2018, 13:00
RE: :getvalue() method - by buuuudzik - 06.11.2018, 13:33
RE: :getvalue() method - by CHOUAIBOU - 06.11.2018, 14:15
RE: :getvalue() method - by buuuudzik - 06.11.2018, 14:41
RE: :getvalue() method - by CHOUAIBOU - 06.11.2018, 16:29

Forum Jump: