This commit is contained in:
bsongis
2014-06-23 10:41:31 +02:00
parent 59b0bca88b
commit 1febac7bf9
+11 -3
View File
@@ -772,9 +772,14 @@ static int luaModelGetCustomFunction(lua_State *L)
lua_newtable(L);
lua_pushtablenumber(L, "switch", CFN_SWITCH(cfn));
lua_pushtablenumber(L, "function", CFN_FUNC(cfn));
lua_pushtablezstring(L, "name", cfn->play.name);
lua_pushtablenumber(L, "value", cfn->all.val);
lua_pushtablenumber(L, "mode", cfn->all.mode);
if (CFN_FUNC(cfn) == FUNC_PLAY_TRACK || CFN_FUNC(cfn) == FUNC_BACKGND_MUSIC || CFN_FUNC(cfn) == FUNC_PLAY_SCRIPT) {
lua_pushtablezstring(L, "name", cfn->play.name);
}
else {
lua_pushtablenumber(L, "value", cfn->all.val);
lua_pushtablenumber(L, "mode", cfn->all.mode);
lua_pushtablenumber(L, "param", cfn->all.param);
}
lua_pushtablenumber(L, "active", CFN_ACTIVE(cfn));
}
else {
@@ -808,6 +813,9 @@ static int luaModelSetCustomFunction(lua_State *L)
else if (!strcmp(key, "mode")) {
cfn->all.mode = luaL_checkinteger(L, -1);
}
else if (!strcmp(key, "param")) {
cfn->all.param = luaL_checkinteger(L, -1);
}
else if (!strcmp(key, "active")) {
CFN_ACTIVE(cfn) = luaL_checkinteger(L, -1);
}