From 73dc62da054cbc18afc694f803ebff7fe24f4eca Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 13 Nov 2021 17:29:45 +0800 Subject: * split --- Runtime/Math/Vector2.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'Runtime/Math/Vector2.h') diff --git a/Runtime/Math/Vector2.h b/Runtime/Math/Vector2.h index aba4262..f83a521 100644 --- a/Runtime/Math/Vector2.h +++ b/Runtime/Math/Vector2.h @@ -70,10 +70,21 @@ namespace Internal void RestoreFromLuaObject(LuaBind::State& state, int index) override { + if (lua_isnil(state, index)) + return; + if (LuaHelper::IsType(state, "GameLab.Engine.Math.Vector2", index)) + { + x = state.GetField(index, "x", 0); + y = state.GetField(index, "y", 0); + } + else if (LuaHelper::IsType(state, "table", index)) + { + x = state.GetField(index, 0, 0); + y = state.GetField(index, 1, 0); + } } - - + T x, y; static Vector2T zero; -- cgit v1.1-26-g67d0