comparison Main.lua @ 459:22f08f6717ea

Updated timer loops to just use math.huge, since their iterations are evaluated in Lua.
author MMOSimca <MMOSimca@gmail.com>
date Wed, 22 Jul 2015 23:18:04 -0400
parents 866bba4d8ab6
children 9f1d3224d316
comparison
equal deleted inserted replaced
458:866bba4d8ab6 459:22f08f6717ea
988 988
989 for index = 1, _G.GetNumLanguages() do 989 for index = 1, _G.GetNumLanguages() do
990 languages_known[_G.GetLanguageByIndex(index)] = true 990 languages_known[_G.GetLanguageByIndex(index)] = true
991 end 991 end
992 992
993 -- These two timers loop indefinitely by constantly resetting their remaining iterations to 100k. 993 -- These two timers loop indefinitely using Lua's infinity constant
994 item_process_timer_handle = C_Timer.NewTicker(30, function() 994 item_process_timer_handle = C_Timer.NewTicker(30, WDP.ProcessItems, math.huge)
995 item_process_timer_handle._remainingIterations = 100000 995 target_location_timer_handle = C_Timer.NewTicker(0.5, WDP.UpdateTargetLocation, math.huge)
996 WDP:ProcessItems()
997 end, 100000)
998 target_location_timer_handle = C_Timer.NewTicker(0.5, function()
999 target_location_timer_handle._remainingIterations = 100000
1000 WDP:UpdateTargetLocation()
1001 end, 100000)
1002 996
1003 _G.hooksecurefunc("UseContainerItem", function(bag_index, slot_index, target_unit) 997 _G.hooksecurefunc("UseContainerItem", function(bag_index, slot_index, target_unit)
1004 if target_unit then 998 if target_unit then
1005 return 999 return
1006 end 1000 end