Advertisement
bs149808

counter_sums

Feb 6th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. --[[ Lua code. See documentation: http://berserk-games.com/knowledgebase/scripting/ --]]
  2.  
  3. guid = {}
  4. guid.cnterA = "faedd9"
  5. guid.cnterB = "460f8a"
  6. guid.cnterC = "ee57a7"
  7.  
  8. obj = {}
  9. obj.cnterA = nil
  10. obj.cnterB = nil
  11. obj.cnterC = nil
  12.  
  13. function onload()
  14. obj.cnterA = getObjectFromGUID(guid.cnterA)
  15. obj.cnterB = getObjectFromGUID(guid.cnterB)
  16. obj.cnterC = getObjectFromGUID(guid.cnterC)
  17. startLuaCoroutine(Global, "SumCoroutine")
  18. end
  19.  
  20. function SumCoroutine()
  21. while true do
  22. obj.cnterC.setValue(obj.cnterA.getValue() + obj.cnterB.getValue())
  23. YieldForSeconds(1)
  24. end
  25. return 1
  26. end
  27.  
  28. function YieldForSeconds(_seconds)
  29. t = os.clock()
  30. while os.clock() - t < _seconds do
  31. coroutine.yield(0)
  32. end
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement