From c9a9b3c9d0d4fed0b02d9935923bfd7dcbc45d1e Mon Sep 17 00:00:00 2001 From: Mattes D Date: Tue, 14 Apr 2020 16:43:21 +0200 Subject: Bindings: Allow coercion between Vector3 subtypes. (#4646) In manually bound functions, allows one to use any Vector3 value, as well as a {x, y, z} table, in Lua as any Vector3 parameter. Has example in Debuggers' /vector command. Unfortunately doesn't work in auto-bindings. --- src/Bindings/DeprecatedBindings.cpp | 58 ------------------------------------- 1 file changed, 58 deletions(-) (limited to 'src/Bindings/DeprecatedBindings.cpp') diff --git a/src/Bindings/DeprecatedBindings.cpp b/src/Bindings/DeprecatedBindings.cpp index fbbf408e6..63b5919ac 100644 --- a/src/Bindings/DeprecatedBindings.cpp +++ b/src/Bindings/DeprecatedBindings.cpp @@ -518,49 +518,6 @@ static int tolua_cWorld_SetSignLines(lua_State * tolua_S) -template -int tolua_Vector3_Abs(lua_State * a_LuaState) -{ - // Retrieve the params, including self: - cLuaState L(a_LuaState); - Vector3 * self; - if (!L.GetStackValues(1, self)) - { - tolua_error(a_LuaState, "invalid 'self' in function 'Vector3:Abs'", nullptr); - return 0; - } - - // Absolutize the vector: - self->Abs(); - return 0; -} - - - - - -template -int tolua_Vector3_Clamp(lua_State * a_LuaState) -{ - // Retrieve the params, including self: - cLuaState L(a_LuaState); - Vector3 * self; - T min, max; - if (!L.GetStackValues(1, self, min, max)) - { - tolua_error(a_LuaState, "invalid parameters for function 'Vector3:Clamp', expected a Vector3 and two numbers", nullptr); - return 0; - } - - // Clamp the vector: - self->Clamp(min, max); - return 0; -} - - - - - void DeprecatedBindings::Bind(lua_State * tolua_S) { tolua_beginmodule(tolua_S, nullptr); @@ -604,21 +561,6 @@ void DeprecatedBindings::Bind(lua_State * tolua_S) tolua_function(tolua_S, "UpdateSign", tolua_cWorld_SetSignLines); tolua_endmodule(tolua_S); - tolua_beginmodule(tolua_S, "Vector3i"); - tolua_function(tolua_S,"abs", tolua_Vector3_Abs); - tolua_function(tolua_S,"clamp", tolua_Vector3_Clamp); - tolua_endmodule(tolua_S); - - tolua_beginmodule(tolua_S, "Vector3f"); - tolua_function(tolua_S,"abs", tolua_Vector3_Abs); - tolua_function(tolua_S,"clamp", tolua_Vector3_Clamp); - tolua_endmodule(tolua_S); - - tolua_beginmodule(tolua_S, "Vector3d"); - tolua_function(tolua_S,"abs", tolua_Vector3_Abs); - tolua_function(tolua_S,"clamp", tolua_Vector3_Clamp); - tolua_endmodule(tolua_S); - tolua_endmodule(tolua_S); } -- cgit v1.2.3