lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hakki Dogusan wrote:

I translated mentioned sample to wxLua.

http://www.dynaset.org/dogusanh/download/wxluaimage.zip (448Kb)

Nice!

I was having a little trouble with a wxBitmap constructor though.

Line 654 in image.wx.lua goes like this:

    this.my_smile_xbm = wx.wxBitmap( smile_bits, smile_width,  smile_height, 1 )

and crashes like this when i run it:
lua: Error while running chunk
wxLua overloaded function wxBitmap(string, number, number, number) has invalid argument
wxLua Function Overload Table:
01. wxBitmap( ... ) - overloaded function
02. wxBitmap(table)
03. wxBitmap(wxImage[, number])
04. wxBitmap(string[, integer])
05. wxBitmap(number, number[, number])
06. wxBitmap(wxBitmap)
07. wxBitmap()

stack traceback:
        [C]: in function 'wxBitmap'
        image.wx.lua:654: in function <image.wx.lua:428>
        (tail call): ?
        image.wx.lua:1185: in function <image.wx.lua:1129>
        (tail call): ?
        image.wx.lua:1207: in function 'OnInit'
        image.wx.lua:1214: in function <image.wx.lua:1212>
        (tail call): ?
        image.wx.lua:1227: in main chunk

lua: Error while running chunk


I assume that in your context it binds to this wxBitmap constructor signature: (From here)

wxBitmap(const char bits[], int width, int height
int depth = 1)

Creates a bitmap from an array of bits.


But all i have in the latest wxLua are these: (from here)

%define_object wxNullBitmap

wxBitmap()
wxBitmap(const wxBitmap& bitmap)
wxBitmap( int width, int height, int depth = -1)
wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY)
wxBitmap(const wxImage &image, int depth = -1)

// %override wxBitmap(LuaTable stringTable where each index is a row in the image)
// C++ Func: wxBitmap(const char **data) Load from XPM
%override_name wxLua_wxBitmapFromXPMData_constructor wxBitmap(LuaTable charTable)

// %override wxBitmap(lua string of data, int type, int width, int height, int depth = -1)
// C++ Func: wxBitmap(const void* data, int type, int width, int height, int depth = -1)
%override_name wxLua_wxBitmapFromData_constructor %win wxBitmap(const wxString& data, int type, int width, int height, int depth = -1)

Where i assume that the latter binds to:

wxBitmap(void* data, int type, int width, int height, int depth = -1)

Creates a bitmap from the given data which is interpreted in platform-dependent manner.


Are you using a different version of wxlua than the one on wxlua.sourceforge.net or am i simply doing something wrong


TIA /Flemming