aboutsummaryrefslogtreecommitdiff
path: root/src/scriptapi.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-03-24 03:28:08 +0200
committerPerttu Ahola <celeron55@gmail.com>2012-03-24 04:24:26 +0200
commit93219e3b9d2eae11a447556dfe837706baeff22a (patch)
tree73b26a9e1bae4375d3c966ac037a3d2602f225ad /src/scriptapi.cpp
parent77120a021df955947841f9646cb61d67a272618b (diff)
downloadminetest-93219e3b9d2eae11a447556dfe837706baeff22a.tar.gz
minetest-93219e3b9d2eae11a447556dfe837706baeff22a.tar.bz2
minetest-93219e3b9d2eae11a447556dfe837706baeff22a.zip
Add sounds, tune things
Diffstat (limited to 'src/scriptapi.cpp')
-rw-r--r--src/scriptapi.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp
index 79da15c49..fce760eb8 100644
--- a/src/scriptapi.cpp
+++ b/src/scriptapi.cpp
@@ -811,11 +811,10 @@ static void push_pointed_thing(lua_State *L, const PointedThing& pointed)
SimpleSoundSpec
*/
-static SimpleSoundSpec read_soundspec(lua_State *L, int index)
+static void read_soundspec(lua_State *L, int index, SimpleSoundSpec &spec)
{
if(index < 0)
index = lua_gettop(L) + 1 + index;
- SimpleSoundSpec spec;
if(lua_isnil(L, index)){
} else if(lua_istable(L, index)){
getstringfield(L, index, "name", spec.name);
@@ -823,7 +822,6 @@ static SimpleSoundSpec read_soundspec(lua_State *L, int index)
} else if(lua_isstring(L, index)){
spec.name = lua_tostring(L, index);
}
- return spec;
}
/*
@@ -1062,7 +1060,10 @@ static ContentFeatures read_content_features(lua_State *L, int index)
lua_getfield(L, index, "sounds");
if(lua_istable(L, -1)){
lua_getfield(L, -1, "footstep");
- f.sound_footstep = read_soundspec(L, -1);
+ read_soundspec(L, -1, f.sound_footstep);
+ lua_pop(L, 1);
+ lua_getfield(L, -1, "dug");
+ read_soundspec(L, -1, f.sound_dug);
lua_pop(L, 1);
}
lua_pop(L, 1);