diff options
author | chai <chaifix@163.com> | 2021-11-13 17:29:45 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-13 17:29:45 +0800 |
commit | 73dc62da054cbc18afc694f803ebff7fe24f4eca (patch) | |
tree | 5ed1fa0166891569e3dd6f3fa9d2ec2a83754624 /Runtime | |
parent | 9b1f8214eea0c86d41f903a5feba9aac78603df1 (diff) |
* split
Diffstat (limited to 'Runtime')
-rw-r--r-- | Runtime/Math/Vector2.h | 15 |
1 files changed, 13 insertions, 2 deletions
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<float>(index, "x", 0); + y = state.GetField<float>(index, "y", 0); + } + else if (LuaHelper::IsType(state, "table", index)) + { + x = state.GetField<float>(index, 0, 0); + y = state.GetField<float>(index, 1, 0); + } } - - + T x, y; static Vector2T<T> zero; |