Skip to content

Commit c17417f

Browse files
committed
set the right position of uniform location
1 parent dc910ef commit c17417f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7343,7 +7343,7 @@ static int lua_cocos2dx_backend_ProgramState_getUniformLocation(lua_State* tolua
73437343

73447344
if (!ok) { break; }
73457345
cocos2d::backend::UniformLocation ret = cobj->getUniformLocation(arg0);
7346-
uniformLocation_to_luaval(tolua_S, ret);
7346+
uniformLocation_to_luaval(tolua_S, ret);
73477347
return 1;
73487348
}
73497349
else if (lua_isnumber(tolua_S, -1))
@@ -7396,23 +7396,23 @@ static int lua_cocos2dx_ProgramState_setUniform(lua_State *tolua_S)
73967396
{
73977397
cocos2d::backend::UniformLocation location;
73987398

7399-
if (lua_isstring(tolua_S, -2))
7399+
if (lua_isstring(tolua_S, 2))
74007400
{
7401-
location = self->getUniformLocation(lua_tostring(tolua_S, -2));
7401+
location = self->getUniformLocation(lua_tostring(tolua_S, 2));
74027402
}
7403-
else if (lua_istable(tolua_S, -2))
7403+
else if (lua_istable(tolua_S, 2))
74047404
{
7405-
ok &= luaval_to_uniformLocation(tolua_S, -2, location, "lua_cocos2dx_ProgramState_setUniform");
7405+
ok &= luaval_to_uniformLocation(tolua_S, 2, location, "ccb.ProgramState:setUniform");
74067406
}
74077407

7408-
if (ok & lua_istable(tolua_S, -1))
7408+
if (ok & lua_istable(tolua_S, 3))
74097409
{
7410-
int len = lua_objlen(tolua_S, -1);
7410+
int len = lua_objlen(tolua_S, 3);
74117411
std::vector<uint8_t> buffer(len);
74127412

74137413
for (int i = 0; i < len; i++)
74147414
{
7415-
lua_rawgeti(tolua_S, -1, i + 1);
7415+
lua_rawgeti(tolua_S, 3, i + 1);
74167416
buffer[i] = lua_tointeger(tolua_S, -1);
74177417
lua_pop(tolua_S, 1);
74187418
}

0 commit comments

Comments
 (0)