summaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-03-27 00:37:31 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-03-27 00:37:31 +0300
commit37b64ff616df3475e228d6beb3727de2afd2b6c2 (patch)
treedcdb6f5b14213dd5dfdb015c51046a0837e53c57 /games
parenta2fd8d1db10bc5b018d40d9b9ffd8595c7543112 (diff)
downloadminetest-37b64ff616df3475e228d6beb3727de2afd2b6c2.tar.gz
minetest-37b64ff616df3475e228d6beb3727de2afd2b6c2.tar.bz2
minetest-37b64ff616df3475e228d6beb3727de2afd2b6c2.zip
Add minetest.after(time, func)
Diffstat (limited to 'games')
-rw-r--r--games/minimal/mods/experimental/init.lua26
1 files changed, 3 insertions, 23 deletions
diff --git a/games/minimal/mods/experimental/init.lua b/games/minimal/mods/experimental/init.lua
index e11086274..5dab41354 100644
--- a/games/minimal/mods/experimental/init.lua
+++ b/games/minimal/mods/experimental/init.lua
@@ -6,38 +6,18 @@
experimental = {}
-timers_to_add = {}
-timers = {}
-minetest.register_globalstep(function(dtime)
- for indes, timer in ipairs(timers_to_add) do
- table.insert(timers, timer)
- end
- timers_to_add = {}
- for index, timer in ipairs(timers) do
- timer.time = timer.time - dtime
- if timer.time <= 0 then
- timer.func()
- timers[index] = nil
- end
- end
-end)
-
-after = function(time, func)
- table.insert(timers_to_add, {time=time, func=func})
-end
-
--[[
stepsound = -1
function test_sound()
print("test_sound")
stepsound = minetest.sound_play("default_grass_footstep", {gain=1.0})
- after(2.0, test_sound)
- --after(0.1, test_sound_stop)
+ minetest.after(2.0, test_sound)
+ --minetest.after(0.1, test_sound_stop)
end
function test_sound_stop()
print("test_sound_stop")
minetest.sound_stop(stepsound)
- after(2.0, test_sound)
+ minetest.after(2.0, test_sound)
end
test_sound()
--]]