From c2c63b2f2df9fecac55080bc28a7e0ef4433d06e Mon Sep 17 00:00:00 2001 From: Bradley Chatha Date: Wed, 3 May 2023 19:50:36 +0100 Subject: [PATCH] deprecate: LuaMultiReturn --- source/lumars/function_.d | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/source/lumars/function_.d b/source/lumars/function_.d index e725f32..ab4ed63 100644 --- a/source/lumars/function_.d +++ b/source/lumars/function_.d @@ -24,6 +24,7 @@ struct LuaVariadic } // (replacing with Tuple soon, not documenting) +deprecated("Deprecated in favour of using std.typecons.Tuple") struct LuaMultiReturn(T...) { alias ValueTuple = T; @@ -775,12 +776,14 @@ unittest unittest { + import std.typecons : tuple; + auto lua = new LuaState(null); lua.register!( luaOverloads!( (int a) { assert(a == 1); return a; }, (string a) { assert(a == "2"); return a; }, - (int a, string b) { assert(a == 1); assert(b == "2"); return LuaMultiReturn!(int, string)(a, b); } + (int a, string b) { assert(a == 1); assert(b == "2"); return tuple(a, b); } ) )("overloaded"); lua.doString(` @@ -794,9 +797,11 @@ unittest unittest { - static LuaMultiReturn!(int, string, bool) multiReturn() + import std.typecons : tuple; + + static auto multiReturn() { - return typeof(return)(20, "40", true); + return tuple(20, "40", true); } auto lua = new LuaState(null); @@ -887,13 +892,15 @@ unittest unittest { + import std.typecons : tuple; + auto lua = new LuaState(null); lua.register!( "normal", (){ return 1; }, "overloaded", luaOverloads!( (int a) { assert(a == 1); return a; }, (string a) { assert(a == "2"); return a; }, - (int a, string b) { assert(a == 1); assert(b == "2"); return LuaMultiReturn!(int, string)(a, b); } + (int a, string b) { assert(a == 1); assert(b == "2"); return tuple(a, b); } ) )("lib");