Browse Source

Fix AngelScript and Lua bindings. Fix Lua samples to use new getters.
Tips: use this one liner to convert Lua scripts to use new getter signature.
find . -type f -exec grep -lP "eventData:Get.+?\(.+?\)" {} \; |xargs -n 1 perl -pi.bak -e 's/eventData:Get(.+?)\((?:([^,)]+),\s*(.*?)|(.+?))\)/eventData[\3\4]:Get\1(\2)/g'

Yao Wei Tjong 姚伟忠 10 years ago
parent
commit
4edba76ec2
41 changed files with 204 additions and 158 deletions
  1. 1 1
      Source/Urho3D/Core/Variant.h
  2. 71 7
      Source/Urho3D/LuaScript/pkgs/Core/Variant.pkg
  3. 2 9
      Source/Urho3D/Script/CoreAPI.cpp
  4. 6 17
      Source/Urho3D/Script/IOAPI.cpp
  5. 9 9
      bin/Data/LuaScripts/02_HelloGUI.lua
  6. 1 1
      bin/Data/LuaScripts/03_Sprites.lua
  7. 1 1
      bin/Data/LuaScripts/04_StaticScene.lua
  8. 1 1
      bin/Data/LuaScripts/05_AnimatingScene.lua
  9. 1 1
      bin/Data/LuaScripts/06_SkeletalAnimation.lua
  10. 1 1
      bin/Data/LuaScripts/07_Billboards.lua
  11. 1 1
      bin/Data/LuaScripts/08_Decals.lua
  12. 1 1
      bin/Data/LuaScripts/09_MultipleViewports.lua
  13. 1 1
      bin/Data/LuaScripts/10_RenderToTexture.lua
  14. 1 1
      bin/Data/LuaScripts/11_Physics.lua
  15. 1 1
      bin/Data/LuaScripts/12_PhysicsStressTest.lua
  16. 2 2
      bin/Data/LuaScripts/13_Ragdolls.lua
  17. 2 2
      bin/Data/LuaScripts/14_SoundEffects.lua
  18. 1 1
      bin/Data/LuaScripts/15_Navigation.lua
  19. 4 4
      bin/Data/LuaScripts/16_Chat.lua
  20. 3 3
      bin/Data/LuaScripts/17_SceneReplication.lua
  21. 1 1
      bin/Data/LuaScripts/18_CharacterDemo.lua
  22. 1 1
      bin/Data/LuaScripts/20_HugeObjectCount.lua
  23. 1 1
      bin/Data/LuaScripts/23_Water.lua
  24. 1 1
      bin/Data/LuaScripts/24_Urho2DSprite.lua
  25. 2 2
      bin/Data/LuaScripts/25_Urho2DParticle.lua
  26. 3 3
      bin/Data/LuaScripts/26_ConsoleInput.lua
  27. 1 1
      bin/Data/LuaScripts/27_Urho2DPhysics.lua
  28. 1 1
      bin/Data/LuaScripts/28_Urho2DPhysicsRope.lua
  29. 1 1
      bin/Data/LuaScripts/30_LightAnimation.lua
  30. 1 1
      bin/Data/LuaScripts/31_MaterialAnimation.lua
  31. 4 4
      bin/Data/LuaScripts/32_Urho2DConstraints.lua
  32. 1 1
      bin/Data/LuaScripts/33_Urho2DSpriterAnimation.lua
  33. 1 1
      bin/Data/LuaScripts/34_DynamicGeometry.lua
  34. 1 1
      bin/Data/LuaScripts/35_SignedDistanceFieldText.lua
  35. 1 1
      bin/Data/LuaScripts/36_Urho2DTileMap.lua
  36. 11 11
      bin/Data/LuaScripts/37_UIDrag.lua
  37. 1 1
      bin/Data/LuaScripts/38_SceneAndUILoad.lua
  38. 6 6
      bin/Data/LuaScripts/39_CrowdNavigation.lua
  39. 1 1
      bin/Data/LuaScripts/40_Localization.lua
  40. 52 52
      bin/Data/LuaScripts/TestScene.lua
  41. 1 1
      bin/Data/LuaScripts/Utilities/Sample.lua

+ 1 - 1
Source/Urho3D/Core/Variant.h

@@ -63,7 +63,7 @@ enum VariantType
     MAX_VAR_TYPES
 };
 
-/// Union for the possible variant values. Also stores non-POD objects such as String which must not exceed 16 bytes in size.
+/// Union for the possible variant values. Also stores non-POD objects such as String and math objects (excluding Matrix) which must not exceed 16 bytes in size. Objects exceeding 16 bytes size are stored in the heap pointed by _ptr.
 struct VariantValue
 {
     union

+ 71 - 7
Source/Urho3D/LuaScript/pkgs/Core/Variant.pkg

@@ -59,6 +59,8 @@ class Variant
     static void _Setup(const char* type);
 
     Variant();
+    Variant(void* value);           // Somehow non-specific type must be declared first so that it get considered last
+    Variant(RefCounted* value);
     Variant(int value);
     Variant(unsigned value);
     Variant(const StringHash& value);
@@ -73,7 +75,6 @@ class Variant
     Variant(const String value);
     Variant(const char* value);
     Variant(const VectorBuffer& value);
-    Variant(void* value);
     Variant(const ResourceRef& value);
     Variant(const ResourceRefList& value);
     Variant(const Vector<Variant>& value);
@@ -81,7 +82,6 @@ class Variant
     Variant(const VariantMap& value);
     Variant(const IntRect& value);
     Variant(const IntVector2& value);
-    Variant(RefCounted* value);
     Variant(const Matrix3& value);
     Variant(const Matrix3x4& value);
     Variant(const Matrix4& value);
@@ -94,6 +94,8 @@ class Variant
 
     void Clear();
 
+    bool operator ==(void* rhs) const;
+    bool operator ==(RefCounted* rhs) const;
     bool operator ==(const Variant& rhs) const;
     bool operator ==(int rhs) const;
     bool operator ==(unsigned rhs) const;
@@ -107,7 +109,6 @@ class Variant
     bool operator ==(const Color& rhs) const;
     bool operator ==(const String rhs) const;
     bool operator ==(const VectorBuffer& rhs) const;
-    bool operator ==(void* rhs) const;
     bool operator ==(const ResourceRef& rhs) const;
     bool operator ==(const ResourceRefList& rhs) const;
     bool operator ==(const Vector<Variant>& rhs) const;
@@ -116,7 +117,6 @@ class Variant
     bool operator ==(const IntRect& rhs) const;
     bool operator ==(const IntVector2& rhs) const;
     bool operator ==(const StringHash& rhs) const;
-    bool operator ==(RefCounted* rhs) const;
     bool operator ==(const Matrix3& rhs) const;
     bool operator ==(const Matrix3x4& rhs) const;
     bool operator ==(const Matrix4& rhs) const;
@@ -133,8 +133,8 @@ class Variant
     const Quaternion& GetQuaternion() const;
     const Color& GetColor() const;
     const String GetString() const;
-    const VectorBuffer GetVectorBuffer() const;
-    void* GetVoidPtr() const;
+    const VectorBuffer GetVectorBuffer @ GetBuffer() const;
+    void* GetVoidPtr(const char* type) const;
     const ResourceRef& GetResourceRef() const;
     const ResourceRefList& GetResourceRefList() const;
     const Vector<Variant>& GetVariantVector() const;
@@ -142,7 +142,7 @@ class Variant
     const Vector<String>& GetStringVector() const;
     const IntRect& GetIntRect() const;
     const IntVector2& GetIntVector2() const;
-    RefCounted* GetPtr() const;
+    RefCounted* GetPtr(const char* type) const;
     const Matrix3& GetMatrix3() const;
     const Matrix3x4& GetMatrix3x4() const;
     const Matrix4& GetMatrix4() const;
@@ -210,6 +210,70 @@ static int tolua_CoreLuaAPI_Variant__Setup00(lua_State* tolua_S)
     return 0;
 }
 
+#define TOLUA_DISABLE_tolua_CoreLuaAPI_Variant_GetVoidPtr00
+static int tolua_CoreLuaAPI_Variant_GetVoidPtr00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"const Variant",0,&tolua_err) ||
+ !tolua_isstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+  const Variant* self = (const Variant*)  tolua_tousertype(tolua_S,1,0);
+  const char* type = ((const char*)  tolua_tostring(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetVoidPtr'", NULL);
+#endif
+ {
+     void* tolua_ret = self->GetVoidPtr();
+     tolua_pushusertype(tolua_S, tolua_ret, type);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetVoidPtr'.",&tolua_err);
+ return 0;
+#endif
+}
+
+#define TOLUA_DISABLE_tolua_CoreLuaAPI_Variant_GetPtr00
+static int tolua_CoreLuaAPI_Variant_GetPtr00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"const Variant",0,&tolua_err) ||
+ !tolua_isstring(tolua_S,2,1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+  const Variant* self = (const Variant*)  tolua_tousertype(tolua_S,1,0);
+  const char* type = ((const char*)  tolua_tostring(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPtr'", NULL);
+#endif
+ {
+     RefCounted* tolua_ret = self->GetPtr();
+     tolua_pushusertype(tolua_S, (void*)tolua_ret, type);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetPtr'.",&tolua_err);
+ return 0;
+#endif
+}
+
 $}
 
 class VariantMap

+ 2 - 9
Source/Urho3D/Script/CoreAPI.cpp

@@ -228,11 +228,6 @@ static void ConstructVariantString(const String& value, Variant* ptr)
     new(ptr) Variant(value);
 }
 
-static void ConstructVariantVectorBuffer(const VectorBuffer& value, Variant* ptr)
-{
-    new(ptr) Variant(value);
-}
-
 static void ConstructVariantResourceRef(const ResourceRef& value, Variant* ptr)
 {
     new(ptr) Variant(value);
@@ -481,6 +476,8 @@ static void RegisterVariant(asIScriptEngine* engine)
 
     RegisterRefCounted<RefCounted>(engine, "RefCounted");
 
+    // Note: Some of the variant bindings are registered in IOAPI::RegisterSerialization() due to dependency to VectorBuffer
+
     engine->RegisterObjectType("Variant", sizeof(Variant), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK);
     engine->RegisterObjectType("VariantMap", sizeof(VariantMap), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK);
     engine->RegisterObjectBehaviour("Variant", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructVariant), asCALL_CDECL_OBJLAST);
@@ -497,7 +494,6 @@ static void RegisterVariant(asIScriptEngine* engine)
     engine->RegisterObjectBehaviour("Variant", asBEHAVE_CONSTRUCT, "void f(const Quaternion&in)", asFUNCTION(ConstructVariantQuaternion), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectBehaviour("Variant", asBEHAVE_CONSTRUCT, "void f(const Color&in)", asFUNCTION(ConstructVariantColor), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectBehaviour("Variant", asBEHAVE_CONSTRUCT, "void f(const String&in)", asFUNCTION(ConstructVariantString), asCALL_CDECL_OBJLAST);
-    engine->RegisterObjectBehaviour("Variant", asBEHAVE_CONSTRUCT, "void f(const VectorBuffer&in)", asFUNCTION(ConstructVariantVectorBuffer), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectBehaviour("Variant", asBEHAVE_CONSTRUCT, "void f(const ResourceRef&in)", asFUNCTION(ConstructVariantResourceRef), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectBehaviour("Variant", asBEHAVE_CONSTRUCT, "void f(const ResourceRefList&in)", asFUNCTION(ConstructVariantResourceRefList), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectBehaviour("Variant", asBEHAVE_CONSTRUCT, "void f(const Array<Variant>@+)", asFUNCTION(ConstructVariantVariantVector), asCALL_CDECL_OBJLAST);
@@ -527,7 +523,6 @@ static void RegisterVariant(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Variant", "Variant& opAssign(const Quaternion&in)", asMETHODPR(Variant, operator =, (const Quaternion&), Variant&), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "Variant& opAssign(const Color&in)", asMETHODPR(Variant, operator =, (const Color&), Variant&), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "Variant& opAssign(const String&in)", asMETHODPR(Variant, operator =, (const String&), Variant&), asCALL_THISCALL);
-    engine->RegisterObjectMethod("Variant", "Variant& opAssign(const VectorBuffer&in)", asMETHODPR(Variant, operator =, (const VectorBuffer&), Variant&), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "Variant& opAssign(const ResourceRef&in)", asMETHODPR(Variant, operator =, (const ResourceRef&), Variant&), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "Variant& opAssign(const ResourceRefList&in)", asMETHODPR(Variant, operator =, (const ResourceRefList&), Variant&), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "Variant& opAssign(const Array<Variant>@+)", asFUNCTION(VariantAssignVariantVector), asCALL_CDECL_OBJLAST);
@@ -553,7 +548,6 @@ static void RegisterVariant(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Variant", "bool opEquals(const Quaternion&in) const", asMETHODPR(Variant, operator ==, (const Quaternion&) const, bool), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "bool opEquals(const Color&in) const", asMETHODPR(Variant, operator ==, (const Color&) const, bool), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "bool opEquals(const String&in) const", asMETHODPR(Variant, operator ==, (const String&) const, bool), asCALL_THISCALL);
-    engine->RegisterObjectMethod("Variant", "bool opEquals(const VectorBuffer&in) const", asMETHODPR(Variant, operator ==, (const VectorBuffer&) const, bool), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "bool opEquals(const ResourceRef&in) const", asMETHODPR(Variant, operator ==, (const ResourceRef&) const, bool), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "bool opEquals(const ResourceRefList&in) const", asMETHODPR(Variant, operator ==, (const ResourceRefList&) const, bool), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "bool opEquals(const Array<Variant>@+)", asFUNCTION(VariantEqualsVariantVector), asCALL_CDECL_OBJLAST);
@@ -578,7 +572,6 @@ static void RegisterVariant(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Variant", "const Quaternion& GetQuaternion() const", asMETHOD(Variant, GetQuaternion), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "const Color& GetColor() const", asMETHOD(Variant, GetColor), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "const String& GetString() const", asMETHOD(Variant, GetString), asCALL_THISCALL);
-    engine->RegisterObjectMethod("Variant", "const VectorBuffer GetString() const", asMETHOD(Variant, GetVectorBuffer), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "const ResourceRef& GetResourceRef() const", asMETHOD(Variant, GetResourceRef), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "const ResourceRefList& GetResourceRefList() const", asMETHOD(Variant, GetResourceRefList), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "Array<Variant>@ GetVariantVector() const", asFUNCTION(VariantGetVariantVector), asCALL_CDECL_OBJLAST);

+ 6 - 17
Source/Urho3D/Script/IOAPI.cpp

@@ -209,15 +209,9 @@ static unsigned char* VectorBufferAt(unsigned index, VectorBuffer* ptr)
     return ptr->GetModifiableData() + index;
 }
 
-static void ConstructVariantBuffer(const VectorBuffer& buffer, Variant* ptr)
+static void ConstructVariantVectorBuffer(const VectorBuffer& value, Variant* ptr)
 {
-    new(ptr) Variant(buffer.GetBuffer());
-}
-
-static Variant& VariantAssignBuffer(const VectorBuffer& buffer, Variant* ptr)
-{
-    *ptr = buffer.GetBuffer();
-    return *ptr;
+    new(ptr) Variant(value);
 }
 
 static VectorBuffer VariantGetBuffer(Variant* ptr)
@@ -226,11 +220,6 @@ static VectorBuffer VariantGetBuffer(Variant* ptr)
     return ret;
 }
 
-static bool VariantEqualsBuffer(const VectorBuffer& buffer, Variant* ptr)
-{
-    return (*ptr) == buffer.GetBuffer();
-}
-
 static FileSystem* GetFileSystem()
 {
     return GetScriptContext()->GetSubsystem<FileSystem>();
@@ -316,10 +305,10 @@ static void RegisterSerialization(asIScriptEngine* engine)
     RegisterDeserializer<VectorBuffer>(engine, "VectorBuffer");
 
     // Register VectorBuffer conversions to Variant
-    engine->RegisterObjectBehaviour("Variant", asBEHAVE_CONSTRUCT, "void f(const VectorBuffer&in)", asFUNCTION(ConstructVariantBuffer), asCALL_CDECL_OBJLAST);
-    engine->RegisterObjectMethod("Variant", "Variant& opAssign(const VectorBuffer&in)", asFUNCTION(VariantAssignBuffer), asCALL_CDECL_OBJLAST);
-    engine->RegisterObjectMethod("Variant", "VectorBuffer GetBuffer() const", asFUNCTION(VariantGetBuffer), asCALL_CDECL_OBJLAST);
-    engine->RegisterObjectMethod("Variant", "bool opEquals(const VectorBuffer&in) const", asFUNCTION(VariantEqualsBuffer), asCALL_CDECL_OBJLAST);
+    engine->RegisterObjectBehaviour("Variant", asBEHAVE_CONSTRUCT, "void f(const VectorBuffer&in)", asFUNCTION(ConstructVariantVectorBuffer), asCALL_CDECL_OBJLAST);
+    engine->RegisterObjectMethod("Variant", "Variant& opAssign(const VectorBuffer&in)", asMETHODPR(Variant, operator =, (const VectorBuffer&), Variant&), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Variant", "bool opEquals(const VectorBuffer&in) const", asMETHODPR(Variant, operator ==, (const VectorBuffer&) const, bool), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Variant", "const VectorBuffer GetBuffer() const", asMETHOD(Variant, GetVectorBuffer), asCALL_THISCALL);
 
     // Register VectorBuffer compression functions
     engine->RegisterGlobalFunction("VectorBuffer CompressVectorBuffer(VectorBuffer&in)", asFUNCTION(CompressVectorBuffer), asCALL_CDECL);

+ 9 - 9
bin/Data/LuaScripts/02_HelloGUI.lua

@@ -103,7 +103,7 @@ function InitWindow()
     buttonClose:SetStyle("CloseButton")
 
     -- Subscribe to buttonClose release (following a 'press') events
-    SubscribeToEvent(buttonClose, "Released", 
+    SubscribeToEvent(buttonClose, "Released",
         function (eventType, eventData)
             engine:Exit()
         end)
@@ -131,23 +131,23 @@ function CreateDraggableFish()
 
     -- Subscribe draggableFish to Drag Events (in order to make it draggable)
     -- See "Event list" in documentation's Main Page for reference on available Events and their eventData
-    SubscribeToEvent(draggableFish, "DragBegin", 
+    SubscribeToEvent(draggableFish, "DragBegin",
         function (eventType, eventData)
             -- Get UIElement relative position where input (touch or click) occured (top-left = IntVector2(0,0))
-            dragBeginPosition = IntVector2(eventData:GetInt("ElementX"), eventData:GetInt("ElementY"))
+            dragBeginPosition = IntVector2(eventData["ElementX"]:GetInt(), eventData["ElementY"]:GetInt())
         end)
 
-    SubscribeToEvent(draggableFish, "DragMove", 
+    SubscribeToEvent(draggableFish, "DragMove",
         function (eventType, eventData)
-            local dragCurrentPosition = IntVector2(eventData:GetInt("X"), eventData:GetInt("Y"))
+            local dragCurrentPosition = IntVector2(eventData["X"]:GetInt(), eventData["Y"]:GetInt())
             -- Get the dragged fish element
             -- Note difference to C++: in C++ we would call GetPtr() and cast the pointer to UIElement, here we must specify
             -- what kind of object we are getting. Null will be returned on type mismatch
-            local draggedElement = eventData:GetPtr("UIElement", "Element")
+            local draggedElement = eventData["Element"]:GetPtr("UIElement")
             draggedElement:SetPosition(dragCurrentPosition - dragBeginPosition)
         end)
-    
-    SubscribeToEvent(draggableFish, "DragEnd", 
+
+    SubscribeToEvent(draggableFish, "DragEnd",
         function (eventType, eventData)
         end)
 end
@@ -158,7 +158,7 @@ function HandleControlClicked(eventType, eventData)
     local windowTitle = tolua.cast(element, 'Text')
 
     -- Get control that was clicked
-    local clicked = eventData:GetPtr("UIElement", "Element")
+    local clicked = eventData["Element"]:GetPtr("UIElement")
     local name = "...?"
     if clicked ~= nil then
         -- Get the name of the control that was clicked

+ 1 - 1
bin/Data/LuaScripts/03_Sprites.lua

@@ -91,7 +91,7 @@ function MoveSprites(timeStep)
 end
 
 function HandleUpdate(eventType, eventData)
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     MoveSprites(timeStep)
 end

+ 1 - 1
bin/Data/LuaScripts/04_StaticScene.lua

@@ -138,7 +138,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 1 - 1
bin/Data/LuaScripts/05_AnimatingScene.lua

@@ -136,7 +136,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 1 - 1
bin/Data/LuaScripts/06_SkeletalAnimation.lua

@@ -170,7 +170,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 1 - 1
bin/Data/LuaScripts/07_Billboards.lua

@@ -251,7 +251,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera and animate the scene, scale movement with time step
     MoveCamera(timeStep)

+ 1 - 1
bin/Data/LuaScripts/08_Decals.lua

@@ -232,7 +232,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 1 - 1
bin/Data/LuaScripts/09_MultipleViewports.lua

@@ -212,7 +212,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 1 - 1
bin/Data/LuaScripts/10_RenderToTexture.lua

@@ -208,7 +208,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 1 - 1
bin/Data/LuaScripts/11_Physics.lua

@@ -224,7 +224,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 1 - 1
bin/Data/LuaScripts/12_PhysicsStressTest.lua

@@ -240,7 +240,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 2 - 2
bin/Data/LuaScripts/13_Ragdolls.lua

@@ -223,7 +223,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)
@@ -246,7 +246,7 @@ end
 
 function CreateRagdoll:HandleNodeCollision(eventType, eventData)
     -- Get the other colliding body, make sure it is moving (has nonzero mass)
-    local otherBody = eventData:GetPtr("RigidBody", "OtherBody")
+    local otherBody = eventData["OtherBody"]:GetPtr("RigidBody")
 
     if otherBody.mass > 0.0 then
         -- We do not need the physics components in the AnimatedModel's root scene node anymore

+ 2 - 2
bin/Data/LuaScripts/14_SoundEffects.lua

@@ -143,12 +143,12 @@ function HandleStopMusic(eventType, eventData)
 end
 
 function HandleSoundVolume(eventType, eventData)
-    local newVolume = eventData:GetFloat("Value")
+    local newVolume = eventData["Value"]:GetFloat()
     audio:SetMasterGain(SOUND_EFFECT, newVolume)
 end
 
 function HandleMusicVolume(eventType, eventData)
-    local newVolume = eventData:GetFloat("Value")
+    local newVolume = eventData["Value"]:GetFloat()
     audio:SetMasterGain(SOUND_MUSIC, newVolume)
 end
 

+ 1 - 1
bin/Data/LuaScripts/15_Navigation.lua

@@ -289,7 +289,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 4 - 4
bin/Data/LuaScripts/16_Chat.lua

@@ -125,7 +125,7 @@ function UpdateButtons()
 end
 
 function HandleLogMessage(eventType, eventData)
-    ShowChatText(eventData:GetString("Message"))
+    ShowChatText(eventData["Message"]:GetString())
 end
 
 function HandleSend(eventType, eventData)
@@ -185,14 +185,14 @@ function HandleStartServer(eventType, eventData)
 end
 
 function HandleNetworkMessage(eventType, eventData)
-    local msgID = eventData:GetInt("MessageID")
+    local msgID = eventData["MessageID"]:GetInt()
     if msgID == MSG_CHAT then
-        local msg = eventData:GetBuffer("Data")
+        local msg = eventData["Data"]:GetBuffer()
         local text = msg:ReadString()
         -- If we are the server, prepend the sender's IP address and port and echo to everyone
         -- If we are a client, just display the message
         if network.serverRunning then
-            local sender = eventData:GetPtr("Connection", "Connection")
+            local sender = eventData["Connection"]:GetPtr("Connection")
             text = sender:ToString() .. " " .. text
             local sendMsg = VectorBuffer()
             sendMsg:WriteString(text)

+ 3 - 3
bin/Data/LuaScripts/17_SceneReplication.lua

@@ -363,7 +363,7 @@ end
 
 function HandleClientConnected(eventType, eventData)
     -- When a client connects, assign to scene to begin scene replication
-    local newConnection = eventData:GetPtr("Connection", "Connection")
+    local newConnection = eventData["Connection"]:GetPtr("Connection")
     newConnection.scene = scene_
 
     -- Then create a controllable object for that client
@@ -381,7 +381,7 @@ end
 
 function HandleClientDisconnected(eventType, eventData)
     -- When a client disconnects, remove the controlled object
-    local connection = eventData:GetPtr("Connection", "Connection")
+    local connection = eventData["Connection"]:GetPtr("Connection")
     for i, v in ipairs(clients) do
         if v.connection == connection then
             v.object:Remove()
@@ -392,7 +392,7 @@ function HandleClientDisconnected(eventType, eventData)
 end
 
 function HandleClientObjectID(eventType, eventData)
-    clientObjectID = eventData:GetUInt("ID")
+    clientObjectID = eventData["ID"]:GetUInt()
 end
 
 -- Create XML patch instructions for screen joystick layout specific to this sample app

+ 1 - 1
bin/Data/LuaScripts/18_CharacterDemo.lua

@@ -343,7 +343,7 @@ function Character:Save(serializer)
 end
 
 function Character:HandleNodeCollision(eventType, eventData)
-    local contacts = eventData:GetBuffer("Contacts")
+    local contacts = eventData["Contacts"]:GetBuffer()
 
     while not contacts.eof do
         local contactPosition = contacts:ReadVector3()

+ 1 - 1
bin/Data/LuaScripts/20_HugeObjectCount.lua

@@ -177,7 +177,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Toggle animation with space
     if input:GetKeyPress(KEY_SPACE) then

+ 1 - 1
bin/Data/LuaScripts/23_Water.lua

@@ -212,7 +212,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 1 - 1
bin/Data/LuaScripts/24_Urho2DSprite.lua

@@ -169,7 +169,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 2 - 2
bin/Data/LuaScripts/25_Urho2DParticle.lua

@@ -96,8 +96,8 @@ end
 
 function HandleMouseMove(eventType, eventData)
     if particleNode ~= nil then
-        local x = eventData:GetInt("x")
-        local y = eventData:GetInt("y")
+        local x = eventData["x"]:GetInt()
+        local y = eventData["y"]:GetInt()
         local camera = cameraNode:GetComponent("Camera")
         particleNode.position = camera:ScreenToWorldPoint(Vector3(x / graphics.width, y / graphics.height, 10.0))
     end

+ 3 - 3
bin/Data/LuaScripts/26_ConsoleInput.lua

@@ -71,8 +71,8 @@ function Start()
 end
 
 function HandleConsoleCommand(eventType, eventData)
-    if eventData:GetString("Id") == "LuaScriptEventInvoker" then
-        HandleInput(eventData:GetString("Command"))
+    if eventData["Id"]:GetString() == "LuaScriptEventInvoker" then
+        HandleInput(eventData["Command"]:GetString())
     end
 end
 
@@ -86,7 +86,7 @@ end
 
 function HandleEscKeyDown(eventType, eventData)
     -- Unlike the other samples, exiting the engine when ESC is pressed instead of just closing the console
-    if eventData:GetInt("Key") == KEY_ESC then
+    if eventData["Key"]:GetInt() == KEY_ESC then
         engine:Exit()
     end
 end

+ 1 - 1
bin/Data/LuaScripts/27_Urho2DPhysics.lua

@@ -163,7 +163,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 1 - 1
bin/Data/LuaScripts/28_Urho2DPhysicsRope.lua

@@ -163,7 +163,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 1 - 1
bin/Data/LuaScripts/30_LightAnimation.lua

@@ -173,7 +173,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 1 - 1
bin/Data/LuaScripts/31_MaterialAnimation.lua

@@ -147,7 +147,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 4 - 4
bin/Data/LuaScripts/32_Urho2DConstraints.lua

@@ -351,7 +351,7 @@ function SubscribeToEvents()
 end
 
 function HandleUpdate(eventType, eventData)
-    local timestep = eventData:GetFloat("TimeStep")
+    local timestep = eventData["TimeStep"]:GetFloat()
     MoveCamera(timestep) -- Move the camera according to frame's time step
     if input:GetKeyPress(KEY_SPACE) then drawDebug = not drawDebug end -- Toggle debug geometry with space
     if input:GetKeyPress(KEY_F5) then scene_:SaveXML(fileSystem:GetProgramDir().."Data/Scenes/Constraints.xml") end -- Save scene
@@ -406,7 +406,7 @@ function HandleMouseMove(eventType, eventData)
 end
 
 function HandleTouchBegin3(eventType, eventData)
-    local rigidBody = physicsWorld:GetRigidBody(eventData:GetInt("X"), eventData:GetInt("Y")) -- Raycast for RigidBody2Ds to pick
+    local rigidBody = physicsWorld:GetRigidBody(eventData["X"]:GetInt(), eventData["Y"]:GetInt()) -- Raycast for RigidBody2Ds to pick
     if rigidBody ~= nil then
         pickedNode = rigidBody.node
         local staticSprite = pickedNode:GetComponent("StaticSprite2D")
@@ -415,7 +415,7 @@ function HandleTouchBegin3(eventType, eventData)
 
         -- ConstraintMouse2D - Temporary apply this constraint to the pickedNode to allow grasping and moving with touch
         local constraintMouse = pickedNode:CreateComponent("ConstraintMouse2D")
-        constraintMouse.target = camera:ScreenToWorldPoint(Vector3(eventData:GetInt("X") / graphics.width, eventData:GetInt("Y") / graphics.height, 0))
+        constraintMouse.target = camera:ScreenToWorldPoint(Vector3(eventData["X"]:GetInt() / graphics.width, eventData["Y"]:GetInt() / graphics.height, 0))
         constraintMouse.maxForce = 1000 * rigidBody.mass
         constraintMouse.collideConnected = true
         constraintMouse.otherBody = dummyBody  -- Use dummy body instead of rigidBody. It's better to create a dummy body automatically in ConstraintMouse2D
@@ -428,7 +428,7 @@ end
 function HandleTouchMove3(eventType, eventData)
     if pickedNode ~= nil then
         local constraintMouse = pickedNode:GetComponent("ConstraintMouse2D")
-        constraintMouse.target = camera:ScreenToWorldPoint(Vector3(eventData:GetInt("X") / graphics.width, eventData:GetInt("Y") / graphics.height, 0))
+        constraintMouse.target = camera:ScreenToWorldPoint(Vector3(eventData["X"]:GetInt() / graphics.width, eventData["Y"]:GetInt() / graphics.height, 0))
     end
 end
 

+ 1 - 1
bin/Data/LuaScripts/33_Urho2DSpriterAnimation.lua

@@ -132,7 +132,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 1 - 1
bin/Data/LuaScripts/34_DynamicGeometry.lua

@@ -299,7 +299,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Toggle animation with space
     if input:GetKeyPress(KEY_SPACE) then

+ 1 - 1
bin/Data/LuaScripts/35_SignedDistanceFieldText.lua

@@ -160,7 +160,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 1 - 1
bin/Data/LuaScripts/36_Urho2DTileMap.lua

@@ -125,7 +125,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 11 - 11
bin/Data/LuaScripts/37_UIDrag.lua

@@ -92,31 +92,31 @@ function SubscribeToEvents()
 end
 
 function HandleDragBegin(eventType, eventData)
-    local element = eventData:GetPtr("UIElement", "Element")
+    local element = eventData["Element"]:GetPtr("UIElement")
 
-    local lx = eventData:GetInt("X")
-    local ly = eventData:GetInt("Y")
+    local lx = eventData["X"]:GetInt()
+    local ly = eventData["Y"]:GetInt()
 
     local p = element.position
     element:SetVar(VAR_START, Variant(p))
     element:SetVar(VAR_DELTA, Variant(Vector2(p.x - lx, p.y - ly)))
 
-    local buttons = eventData:GetInt("Buttons")
+    local buttons = eventData["Buttons"]:GetInt()
     element:SetVar(VAR_BUTTONS, Variant(buttons))
 
     local t = tolua.cast(element:GetChild("Text"), 'Text')
     t:SetText("Drag Begin Buttons: " .. buttons)
 
     t = tolua.cast(element:GetChild("Num Touch"), 'Text')
-    t:SetText("Number of buttons: " .. eventData:GetInt("NumButtons"))
+    t:SetText("Number of buttons: " .. eventData["NumButtons"]:GetInt())
 end
 
 function HandleDragMove(eventType, eventData)
-    local element = eventData:GetPtr("UIElement", "Element")
-    local buttons = eventData:GetInt("Buttons")
+    local element = eventData["Element"]:GetPtr("UIElement")
+    local buttons = eventData["Buttons"]:GetInt()
     local d = element:GetVar(VAR_DELTA):GetVector2()
-    local X = eventData:GetInt("X") + d.x
-    local Y = eventData:GetInt("Y") + d.y
+    local X = eventData["X"]:GetInt() + d.x
+    local Y = eventData["Y"]:GetInt() + d.y
     local BUTTONS = element:GetVar(VAR_BUTTONS):GetInt()
 
     local t = tolua.cast(element:GetChild("Event Touch"), 'Text')
@@ -126,7 +126,7 @@ function HandleDragMove(eventType, eventData)
 end
 
 function HandleDragCancel(eventType, eventData)
-    local element = eventData:GetPtr("UIElement", "Element")
+    local element = eventData["Element"]:GetPtr("UIElement")
     local P = element:GetVar(VAR_START):GetIntVector2()
     element:SetPosition(P)
 end
@@ -163,5 +163,5 @@ function GetScreenJoystickPatchString()
         "        <attribute name=\"Is Visible\" value=\"false\" />" ..
         "    </add>" ..
         "</patch>"
-        
+
 end

+ 1 - 1
bin/Data/LuaScripts/38_SceneAndUILoad.lua

@@ -97,7 +97,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)

+ 6 - 6
bin/Data/LuaScripts/39_CrowdNavigation.lua

@@ -369,7 +369,7 @@ end
 
 function HandleUpdate(eventType, eventData)
     -- Take the frame time step, which is stored as a float
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
 
     -- Move the camera, scale movement with time step
     MoveCamera(timeStep)
@@ -385,8 +385,8 @@ function HandlePostRenderUpdate(eventType, eventData)
 end
 
 function HandleCrowdAgentFailure(eventType, eventData)
-    local node = eventData:GetPtr("Node", "Node")
-    local agentState = eventData:GetInt("CrowdAgentState")
+    local node = eventData["Node"]:GetPtr("Node")
+    local agentState = eventData["CrowdAgentState"]:GetInt()
 
     -- If the agent's state is invalid, likely from spawning on the side of a box, find a point in a larger area
     if agentState == CROWD_AGENT_INVALID then
@@ -400,9 +400,9 @@ end
 function HandleCrowdAgentReposition(eventType, eventData)
     local WALKING_ANI = "Models/Jack_Walk.ani"
 
-    local node = eventData:GetPtr("Node", "Node")
-    local agent = eventData:GetPtr("CrowdAgent", "CrowdAgent")
-    local velocity = eventData:GetVector3("Velocity")
+    local node = eventData["Node"]:GetPtr("Node")
+    local agent = eventData["CrowdAgent"]:GetPtr("CrowdAgent")
+    local velocity = eventData["Velocity"]:GetVector3()
 
     -- Only Jack agent has animation controller
     local animCtrl = node:GetComponent("AnimationController")

+ 1 - 1
bin/Data/LuaScripts/40_Localization.lua

@@ -135,7 +135,7 @@ function CreateScene()
 end
 
 function HandleUpdate(eventType, eventData)
-    local timeStep = eventData:GetFloat("TimeStep")
+    local timeStep = eventData["TimeStep"]:GetFloat()
     local MOUSE_SENSITIVITY = 0.1
     local mouseMove = input.mouseMove
     yaw = yaw + MOUSE_SENSITIVITY * mouseMove.x

+ 52 - 52
bin/Data/LuaScripts/TestScene.lua

@@ -15,11 +15,11 @@ function Start()
     else
         OpenConsoleWindow()
     end
-    
+
     ParseNetworkArguments()
 
     InitScene()
-    
+
     SubscribeToEvent("Update", "HandleUpdate")
     SubscribeToEvent("KeyDown", "HandleKeyDown")
     SubscribeToEvent("MouseMove", "HandleMouseMove")
@@ -28,9 +28,9 @@ function Start()
     SubscribeToEvent("PostRenderUpdate", "HandlePostRenderUpdate")
     SubscribeToEvent("SpawnBox", "HandleSpawnBox")
     SubscribeToEvent("PhysicsCollision", "HandlePhysicsCollision")
-    
+
     network:RegisterRemoteEvent("SpawnBox")
-    
+
     if runServer then
         network:StartServer(serverPort)
         SubscribeToEvent("ClientConnected", "HandleClientConnected")
@@ -38,7 +38,7 @@ function Start()
         -- Disable physics interpolation to ensure clients get sent physically correct transforms
         testScene:GetComponent("PhysicsWorld"):SetInterpolation(false)
     end
-    
+
     if runClient then
         network:Connect(serverAddress, serverPort, testScene)
     end
@@ -63,12 +63,12 @@ end
 
 function InitUI()
     local uiStyle = cache:GetResource("XMLFile", "UI/DefaultStyle.xml")
-    
+
     local newCursor = Cursor:new()
     newCursor.styleAuto = uiStyle
     newCursor.position = IntVector2(graphics:GetWidth()/ 2, graphics:GetHeight() / 2)
     ui.cursor = newCursor
-    
+
     if GetPlatform() == "Android" or GetPlatform() == "iOS" then
         ui.cursor.visible = false
     end
@@ -76,7 +76,7 @@ end
 
 function InitScene()
     testScene = Scene()
-    
+
     -- Create the camera outside the scene so it is unaffected by scene load/save
     cameraNode = Node()
     camera = cameraNode:CreateComponent("Camera")
@@ -84,7 +84,7 @@ function InitScene()
 
     if not engine:IsHeadless() then
         renderer:SetViewport(0, Viewport:new(testScene, camera))
-        
+
         -- Add bloom & FXAA effects to the renderpath. Clone the default renderpath so that we don't affect it
         -- local newRenderPathPtr = renderer:GetViewport(0):GetRenderPath():Clone()
         -- local newRenderPath = newRenderPathPtr:Get()
@@ -96,7 +96,7 @@ function InitScene()
         renderer:GetViewport(0):SetRenderPath(newRenderPath)
         audio:SetListener(cameraNode:CreateComponent("SoundListener"))
     end
-    
+
     if runClient then
         return
     end
@@ -112,11 +112,11 @@ function InitScene()
     zone.fogStart = 100.0
     zone.fogEnd = 300.0
     zone.boundingBox = BoundingBox(-1000, 1000)
-    
+
     if true then
         local lightNode = testScene:CreateChild("GlobalLight")
         lightNode.direction = Vector3(0.3, -0.5, 0.425)
-        
+
         local light = lightNode:CreateComponent("Light")
         light.lightType = LIGHT_DIRECTIONAL
         light.castShadows = true
@@ -129,7 +129,7 @@ function InitScene()
         local objectNode = testScene:CreateChild("Floor")
         objectNode.position = Vector3(0, -0.5, 0)
         objectNode.scale = Vector3(200, 1, 200)
-        
+
         local object = objectNode:CreateComponent("StaticModel")
         object.model = cache:GetResource("Model", "Models/Box.mdl")
         object.material = cache:GetResource("Material", "Materials/StoneTiled.xml")
@@ -170,9 +170,9 @@ function InitScene()
         local shape = objectNode:CreateComponent("CollisionShape")
         shape:SetBox(Vector3(1, 1, 1))
     end
-    
-    
-    
+
+
+
     for i = 1, 50 do
         local objectNode = testScene:CreateChild("Mushroom")
         objectNode.position = Vector3(Random() * 180 - 90, 0, Random() * 180 - 90)
@@ -189,7 +189,7 @@ function InitScene()
         shape:SetTriangleMesh(object:GetModel())
     end
 
-    
+
     for i = 1, 50 do
         local objectNode = testScene:CreateChild("Jack")
         objectNode:SetPosition(Vector3(Random() * 180 - 90, 0, Random() * 180 - 90))
@@ -199,11 +199,11 @@ function InitScene()
         object.model = cache:GetResource("Model", "Models/Jack.mdl")
         object.material = cache:GetResource("Material", "Materials/Jack.xml")
         object.castShadows = true
-        
+
         -- Create a capsule shape for detecting collisions
         local body = objectNode:CreateComponent("RigidBody")
         body.trigger = true
-        
+
         local shape = objectNode:CreateComponent("CollisionShape")
         shape:SetCapsule(0.7, 1.8, Vector3(0.0, 0.9, 0.0))
         local ctrl = objectNode:CreateComponent("AnimationController")
@@ -212,19 +212,19 @@ function InitScene()
 end
 
 function HandleUpdate(eventType, eventData)
-    local timeStep = eventData:GetFloat("TimeStep")
-    
+    local timeStep = eventData["TimeStep"]:GetFloat()
+
     if ui:GetFocusElement() == nil then
         local speedMultiplier = 1.0
         if input:GetKeyDown(KEY_LSHIFT) then
             speedMultiplier = 5.0
-        end        
+        end
         if input:GetKeyDown(KEY_LCTRL) then
             speedMultiplier = 0.1
         end
-        
+
         local speed = timeStep * speedMultiplier
-        
+
         if input:GetKeyDown(KEY_W) then
             cameraNode:Translate(Vector3(0, 0, 10) * speed)
         end
@@ -237,11 +237,11 @@ function HandleUpdate(eventType, eventData)
         if input:GetKeyDown(KEY_D) then
             cameraNode:Translate(Vector3(10, 0, 0) * speed)
         end
-    end    
+    end
 end
 
 function HandleKeyDown(eventType, eventData)
-    local key = eventData:GetInt("Key")
+    local key = eventData["Key"]:GetInt()
 
     if key == KEY_ESC then
         if ui:GetFocusElement() == nil then
@@ -254,7 +254,7 @@ function HandleKeyDown(eventType, eventData)
     if key == KEY_F1 then
         console:Toggle()
     end
-    
+
     if ui:GetFocusElement() == nil then
         if key == KEY_1 then
             local quality = renderer:GetTextureQuality()
@@ -264,7 +264,7 @@ function HandleKeyDown(eventType, eventData)
             end
             renderer:SetTextureQuality(quality)
         end
-        
+
         if key == KEY_2 then
             local quality = renderer:GetMaterialQuality()
             quality = quality + 1
@@ -273,7 +273,7 @@ function HandleKeyDown(eventType, eventData)
             end
             renderer:SetMaterialQuality(quality)
         end
-        
+
         if key == KEY_3 then
             renderer:SetSpecularLighting(not renderer:GetSpecularLighting())
         end
@@ -304,7 +304,7 @@ function HandleKeyDown(eventType, eventData)
                 renderer:SetMaxOccluderTriangles(0)
             end
         end
-        
+
         if key == KEY_8 then
             renderer:SetDynamicInstancing(not renderer:GetDynamicInstancing())
         end
@@ -331,23 +331,23 @@ function HandleKeyDown(eventType, eventData)
         if key == KEY_T then
             debugHud:Toggle(DEBUGHUD_SHOW_PROFILER)
         end
-        
-        
+
+
         if key == KEY_F5  then
             testScene:SaveXML(fileSystem:GetProgramDir() + "Data/Scenes/LuaTestScene.xml")
         end
-        
+
         if key == KEY_F7 then
             testScene:LoadXML(fileSystem:GetProgramDir() + "Data/Scenes/LuaTestScene.xml")
         end
-    end    
+    end
 end
 
 function HandleMouseMove(eventType, eventData)
-    local buttons = eventData:GetInt("Buttons")
+    local buttons = eventData["Buttons"]:GetInt()
     if buttons == MOUSEB_RIGHT then
-        local mousedx = eventData:GetInt("DX")
-        local mousedy = eventData:GetInt("DY")
+        local mousedx = eventData["DX"]:GetInt()
+        local mousedy = eventData["DY"]:GetInt()
         yaw = yaw + (mousedx / 10.0)
         pitch = pitch + (mousedy / 10.0)
         if pitch < -90.0 then
@@ -362,12 +362,12 @@ end
 
 
 function HandleMouseButtonDown(eventType, eventData)
-    local button = eventData:GetInt("Button")
+    local button = eventData["Button"]:GetInt()
     if button == MOUSEB_RIGHT then
         local cursor = ui:GetCursor()
-        cursor:SetVisible(false)        
-    end    
-    
+        cursor:SetVisible(false)
+    end
+
     -- Test either creating a new physics object or painting a decal (SHIFT down)
     if button == MOUSEB_LEFT and ui:GetElementAt(ui:GetCursorPosition(), true) == nil and ui:GetFocusElement() == nil then
         if not input:GetQualifierDown(QUAL_SHIFT) then
@@ -407,14 +407,14 @@ function HandleMouseButtonDown(eventType, eventData)
 end
 
 function HandleSpawnBox(eventType, eventData)
-    local position = eventData:GetVector3("Pos")
-    local rotation = eventData:GetQuaternion("Rot")
-    
+    local position = eventData["Pos"]:GetVector3()
+    local rotation = eventData["Rot"]:GetQuaternion()
+
     local newNode = testScene:CreateChild("")
     newNode.position = position
     newNode.rotation =rotation
     newNode:SetScale(0.2)
-    
+
     local body = newNode:CreateComponent("RigidBody")
     body.mass = 1.0
     body.friction = 1.0
@@ -432,7 +432,7 @@ function HandleSpawnBox(eventType, eventData)
 end
 
 function HandleMouseButtonUp(eventType, eventData)
-    if eventData:GetInt("Button") == MOUSEB_RIGHT then
+    if eventData["Button"]:GetInt() == MOUSEB_RIGHT then
         ui:GetCursor():SetVisible(true)
     end
 end
@@ -441,7 +441,7 @@ function HandlePostRenderUpdate()
     if engine.headless then
         return
     end
-    
+
     -- Draw rendering debug geometry without depth test to see the effect of occlusion
     if drawDebug == 1 then
         renderer:DrawDebugGeometry(true)
@@ -449,7 +449,7 @@ function HandlePostRenderUpdate()
     if drawDebug == 2 then
         testScene:GetComponent("PhysicsWorld"):DrawDebugGeometry(true)
     end
-    
+
     local pos = ui.cursorPosition
     if ui:GetElementAt(pos, true) == nil and testScene:GetComponent("Octree") ~= nil then
         local cameraRay = camera:GetScreenRay(pos.x / graphics:GetWidth(), pos.y / graphics:GetHeight())
@@ -463,7 +463,7 @@ function HandlePostRenderUpdate()
 end
 
 function HandleClientConnected(eventType, eventData)
-    local connection = eventData:GetPtr("Connection", "Connection")
+    local connection = eventData["Connection"]:GetPtr("Connection")
     connection.scene = testScene -- Begin scene replication to the client
     connection.logStatistics = true
 end
@@ -471,8 +471,8 @@ end
 
 function HandlePhysicsCollision(eventType, eventData)
     -- Check if either of the nodes has an AnimatedModel component
-    local nodeA = eventData:GetPtr("Node", "NodeA")
-    local nodeB = eventData:GetPtr("Node", "NodeB")
+    local nodeA = eventData["NodeA"]:GetPtr("Node")
+    local nodeB = eventData["NodeB"]:GetPtr("Node")
     if nodeA:HasComponent("AnimatedModel") then
         HandleHit(nodeA)
     elseif nodeB:HasComponent("AnimatedModel") then
@@ -500,7 +500,7 @@ function CreateRagdoll(model)
     CreateRagdollBone(root, "Bip01_R_UpperArm", SHAPE_CAPSULE, Vector3(0.15, 0.35, 0.15), Vector3(0.1, 0, 0), Quaternion(0, 0, 90))
     CreateRagdollBone(root, "Bip01_L_Forearm", SHAPE_CAPSULE, Vector3(0.125, 0.4, 0.125), Vector3(0.2, 0, 0), Quaternion(0, 0, 90))
     CreateRagdollBone(root, "Bip01_R_Forearm", SHAPE_CAPSULE, Vector3(0.125, 0.4, 0.125), Vector3(0.2, 0, 0), Quaternion(0, 0, 90))
-    
+
     CreateRagdollConstraint(root, "Bip01_L_Thigh", "Bip01_Pelvis", CONSTRAINT_CONETWIST, Vector3(0, 0, -1), Vector3(0, 0, 1), Vector2(45, 45), Vector2(0, 0), true)
     CreateRagdollConstraint(root, "Bip01_R_Thigh", "Bip01_Pelvis", CONSTRAINT_CONETWIST, Vector3(0, 0, -1), Vector3(0, 0, 1), Vector2(45, 45), Vector2(0, 0), true)
     CreateRagdollConstraint(root, "Bip01_L_Calf", "Bip01_L_Thigh", CONSTRAINT_HINGE, Vector3(0, 0, -1), Vector3(0, 0, -1), Vector2(90, 0), Vector2(0, 0), true)

+ 1 - 1
bin/Data/LuaScripts/Utilities/Sample.lua

@@ -122,7 +122,7 @@ function CreateConsoleAndDebugHud()
 end
 
 function HandleKeyDown(eventType, eventData)
-    local key = eventData:GetInt("Key")
+    local key = eventData["Key"]:GetInt()
     -- Close console (if open) or exit when ESC is pressed
     if key == KEY_ESC then
         if not console:IsVisible() then