summaryrefslogtreecommitdiff
path: root/Runtime/Math
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/Math')
-rw-r--r--Runtime/Math/Vector2.h15
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;