From 086a0030b1f278d5af132a7e401b5525b2416f0a Mon Sep 17 00:00:00 2001 From: bjorn Date: Sat, 6 Oct 2018 16:15:38 -0700 Subject: [PATCH] Shader:send/ShaderBlock:send fills in nils with 0's; --- src/api/types/shader.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/api/types/shader.c b/src/api/types/shader.c index 21ffc65c..93be5507 100644 --- a/src/api/types/shader.c +++ b/src/api/types/shader.c @@ -58,8 +58,8 @@ int luax_checkuniform(lua_State* L, int index, const Uniform* uniform, void* des } switch (uniform->type) { - case UNIFORM_FLOAT: *((float*) dest + i) = luaL_checknumber(L, j); break; - case UNIFORM_INT: *((int*) dest + i) = luaL_checkinteger(L, j); break; + case UNIFORM_FLOAT: *((float*) dest + i) = luaL_optnumber(L, j, 0.); break; + case UNIFORM_INT: *((int*) dest + i) = luaL_optinteger(L, j, 0); break; case UNIFORM_SAMPLER: *((Texture**) dest + i) = luax_checktype(L, j, Texture); TextureType type = lovrTextureGetType(*((Texture**) dest + i)); @@ -108,11 +108,11 @@ int luax_checkuniform(lua_State* L, int index, const Uniform* uniform, void* des switch (uniform->type) { case UNIFORM_FLOAT: case UNIFORM_MATRIX: - *((float*) dest + i * components + j) = luaL_checknumber(L, -1); + *((float*) dest + i * components + j) = luaL_optnumber(L, -1, 0.); break; case UNIFORM_INT: - *((int*) dest + i * components + j) = luaL_checkinteger(L, -1); + *((int*) dest + i * components + j) = luaL_optinteger(L, -1, 0); break; case UNIFORM_SAMPLER: @@ -137,11 +137,11 @@ int luax_checkuniform(lua_State* L, int index, const Uniform* uniform, void* des switch (uniform->type) { case UNIFORM_FLOAT: case UNIFORM_MATRIX: - *((float*) dest + i * components + j) = luaL_checknumber(L, -1); + *((float*) dest + i * components + j) = luaL_optnumber(L, -1, 0.); break; case UNIFORM_INT: - *((float*) dest + i * components + j) = luaL_checknumber(L, -1); + *((float*) dest + i * components + j) = luaL_optinteger(L, -1, 0); break; case UNIFORM_SAMPLER: