From 041aa2fc238ab0bf01d274dd7b1710c91e5c8dc5 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sat, 6 Nov 2021 10:43:43 -0300 Subject: [PATCH] Revert Shader:send to cause a Lua error instead of returning false, if the given variable doesn't exist or is optimized out in the shader. --- src/modules/graphics/wrap_Shader.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/modules/graphics/wrap_Shader.cpp b/src/modules/graphics/wrap_Shader.cpp index 706c77de3..bd3ad5bb7 100644 --- a/src/modules/graphics/wrap_Shader.cpp +++ b/src/modules/graphics/wrap_Shader.cpp @@ -447,18 +447,12 @@ int w_Shader_send(lua_State *L) const Shader::UniformInfo *info = shader->getUniformInfo(name); if (info == nullptr) - { - luax_pushboolean(L, false); - return 1; - } + return luaL_error(L, "Shader uniform '%s' does not exist.\nA common error is to define but not use the variable.", name); if (luax_istype(L, 3, Data::type) || (info->baseType == Shader::UNIFORM_MATRIX && luax_istype(L, 4, Data::type))) - w_Shader_sendData(L, 3, shader, info, false); + return w_Shader_sendData(L, 3, shader, info, false); else - w_Shader_sendLuaValues(L, 3, shader, info, name); - - luax_pushboolean(L, true); - return 1; + return w_Shader_sendLuaValues(L, 3, shader, info, name); } int w_Shader_sendColors(lua_State *L)