Page 1 of 1

[LuaScriptModule] size_t being used in place of unsigned int

Posted: Thu Mar 10, 2011 19:54
by IrmatDen
Hi,

I've found a few size_t used instead of unsigned int in lua bindings, specifically in Affector.pkg, Animation.pkg, AnimationManager.pkg and Window.pkg. Having size_t leads to userdata imported in lua code, and it seems I can't get a number out of it (well, I didn't found any way to do so I mean :oops:).

Hg shelve content for the fixes:

Code: Select all

diff --git a/cegui/src/ScriptingModules/LuaScriptModule/package/Affector.pkg b/cegui/src/ScriptingModules/LuaScriptModule/package/Affector.pkg
--- a/cegui/src/ScriptingModules/LuaScriptModule/package/Affector.pkg
+++ b/cegui/src/ScriptingModules/LuaScriptModule/package/Affector.pkg
@@ -26,8 +26,8 @@
     tolua_throws|CEGUI::InvalidRequestException,error| void destroyKeyFrame(KeyFrame* keyframe);
 
     tolua_throws|CEGUI::InvalidRequestException,nil| KeyFrame* getKeyFrameAtPosition(float position) const;
-    tolua_throws|CEGUI::InvalidRequestException,nil| KeyFrame* getKeyFrameAtIdx(size_t index) const;
-    size_t getNumKeyFrames() const;
+    tolua_throws|CEGUI::InvalidRequestException,nil| KeyFrame* getKeyFrameAtIdx(unsigned int index) const;
+    unsigned int getNumKeyFrames() const;
 
 };
 
diff --git a/cegui/src/ScriptingModules/LuaScriptModule/package/Animation.pkg b/cegui/src/ScriptingModules/LuaScriptModule/package/Animation.pkg
--- a/cegui/src/ScriptingModules/LuaScriptModule/package/Animation.pkg
+++ b/cegui/src/ScriptingModules/LuaScriptModule/package/Animation.pkg
@@ -27,5 +27,5 @@
                              utf8string interpolator);
     tolua_throws|CEGUI::InvalidRequestException,error| void destroyAffector(Affector* affector);
 
-    tolua_throws|CEGUI::InvalidRequestException,nil| Affector* getAffectorAtIdx(size_t index) const;
+    tolua_throws|CEGUI::InvalidRequestException,nil| Affector* getAffectorAtIdx(unsigned int index) const;
 
@@ -31,5 +31,5 @@
 
-    size_t getNumAffectors(void) const;
+    unsigned int getNumAffectors(void) const;
 
     tolua_throws|CEGUI::InvalidRequestException,error| void defineAutoSubscription(utf8string eventName, utf8string action);
     tolua_throws|CEGUI::InvalidRequestException,error| void undefineAutoSubscription(utf8string eventName,
diff --git a/cegui/src/ScriptingModules/LuaScriptModule/package/AnimationManager.pkg b/cegui/src/ScriptingModules/LuaScriptModule/package/AnimationManager.pkg
--- a/cegui/src/ScriptingModules/LuaScriptModule/package/AnimationManager.pkg
+++ b/cegui/src/ScriptingModules/LuaScriptModule/package/AnimationManager.pkg
@@ -14,5 +14,5 @@
     tolua_throws|CEGUI::UnknownObjectException,nil| void destroyAnimation(Animation* animation);
     tolua_throws|CEGUI::UnknownObjectException,nil| void destroyAnimation(utf8string name);
     tolua_throws|CEGUI::UnknownObjectException,nil| Animation* getAnimation(utf8string name) const;
-    tolua_throws|CEGUI::InvalidRequestException,nil| Animation* getAnimationAtIdx(size_t index) const;
+    tolua_throws|CEGUI::InvalidRequestException,nil| Animation* getAnimationAtIdx(unsigned int index) const;
 
@@ -18,8 +18,8 @@
 
-    size_t getNumAnimations() const;
+    unsigned int getNumAnimations() const;
 
     tolua_throws|CEGUI::UnknownObjectException,nil| AnimationInstance* instantiateAnimation(Animation* animation);
     tolua_throws|CEGUI::UnknownObjectException,nil| AnimationInstance* instantiateAnimation(utf8string name);
     tolua_throws|CEGUI::InvalidRequestException,nil| void destroyAnimationInstance(AnimationInstance* instance);
     void destroyAllInstancesOfAnimation(Animation* animation);
 
@@ -20,8 +20,8 @@
 
     tolua_throws|CEGUI::UnknownObjectException,nil| AnimationInstance* instantiateAnimation(Animation* animation);
     tolua_throws|CEGUI::UnknownObjectException,nil| AnimationInstance* instantiateAnimation(utf8string name);
     tolua_throws|CEGUI::InvalidRequestException,nil| void destroyAnimationInstance(AnimationInstance* instance);
     void destroyAllInstancesOfAnimation(Animation* animation);
 
-    tolua_throws|CEGUI::InvalidRequestException,nil| AnimationInstance* getAnimationInstanceAtIdx(size_t index) const;
+    tolua_throws|CEGUI::InvalidRequestException,nil| AnimationInstance* getAnimationInstanceAtIdx(unsigned int index) const;
 
@@ -27,5 +27,5 @@
 
-    size_t getNumAnimationInstances() const;
+    unsigned int getNumAnimationInstances() const;
 
     void stepInstances(float delta);
 
diff --git a/cegui/src/ScriptingModules/LuaScriptModule/package/Window.pkg b/cegui/src/ScriptingModules/LuaScriptModule/package/Window.pkg
--- a/cegui/src/ScriptingModules/LuaScriptModule/package/Window.pkg
+++ b/cegui/src/ScriptingModules/LuaScriptModule/package/Window.pkg
@@ -279,7 +279,7 @@
 
     Window* clone(utf8string newName, bool deepCopy = true) const;
 
-    size_t getZIndex() const;
+    unsigned int getZIndex() const;
     bool isInFront(const Window& wnd) const;
     bool isBehind(const Window& wnd) const;
 

Re: [LuaScriptModule] size_t being used in place of unsigned

Posted: Mon Mar 14, 2011 09:29
by CrazyEddie
Thanks for these fixes, I will get them applied soon.

CE

Re: [LuaScriptModule] size_t being used in place of unsigned

Posted: Wed Mar 16, 2011 14:42
by CrazyEddie
I've applied this fix in v0-7; it should get merged back into default some time soon (may be later today). Thanks again.

CE

Re: [LuaScriptModule] size_t being used in place of unsigned

Posted: Wed Mar 16, 2011 16:19
by IrmatDen
You're welcome :)