Page 1 of 1

Lua bindings for TreeItem using "String" instead of "string"

Posted: Sat May 15, 2010 18:42
by ErikHjortsberg
The Lua bindings for TreeItem (found in TreeItem.pkg) use the "String" datatype instead of the "string" datatype used in all other bindings. The end result is that Lua will expect a CEGUI::String object instead of the native string used in Lua. I'm guessing this is unintentional.

For some reason I couldn't log in to Mantis and I couldn't find any place in which to either register or request a new password, so I'll post the patch here instead.

Code: Select all

Index: cegui/src/ScriptingModules/LuaScriptModule/package/elements/TreeItem.pkg
===================================================================
--- cegui/src/ScriptingModules/LuaScriptModule/package/elements/TreeItem.pkg   (revision 2519)
+++ cegui/src/ScriptingModules/LuaScriptModule/package/elements/TreeItem.pkg   (arbetskopia)
@@ -6,13 +6,13 @@
     Font* getFont() const;
     ColourRect getTextColours() const;
     void setFont(Font* font);
-    void setFont(const String& font_name);
+    void setFont(const string& font_name);
     void setTextColours(const ColourRect& cols);
     void setTextColours(colour top_left_colour, colour top_right_colour,
                         colour bottom_left_colour, colour bottom_right_colour);
     void setTextColours(colour col);
-    const String &getText() const;
-    const String &getTooltipText() const;
+    const string &getText() const;
+    const string &getTooltipText() const;
     unsigned int getID() const;
     void *getUserData() const;
     bool isSelected() const;
@@ -21,8 +21,8 @@
     const Window *getOwnerWindow();
     ColourRect getSelectionColours() const;
     const Image* getSelectionBrushImage() const;
-    void setText(const String& text);
-    void setTooltipText(const String& text);
+    void setText(const string& text);
+    void setTooltipText(const string& text);
     void setID(unsigned int item_id);
     void setUserData(void* item_data);
     void setSelected(bool setting);
@@ -33,7 +33,7 @@
     void setSelectionColours(colour top_left_colour,colour top_right_colour,colour bottom_left_colour,colour bottom_right_colour);
     void setSelectionColours(colour col);
     void setSelectionBrushImage(const Image* image);
-    void setSelectionBrushImage(const String& imageset, const String& image);
+    void setSelectionBrushImage(const string& imageset, const string& image);
     void setButtonLocation(Rect &buttonOffset);
     Rect &getButtonLocation();
     bool getIsOpen();


Re: Lua bindings for TreeItem using "String" instead of "string"

Posted: Sun May 16, 2010 07:35
by CrazyEddie
Thanks for this, you're right that the use of the CEGUI::String there is a mistake.

I'm not sure why mantis did not allow you to log in, I'll investigate that because your same log-in details should work for all parts of the site.

CE.