Hi,

Ray Gilbert ha scritto:
I have added the ability to add overloaded functions to wxLua
indeed this feature looks great !

- added test directly into wx_bind.cpp #define TESTOVERLOAD
#if defined(TESTOVERLOAD)
// Test Overloaded Function Binding
// a std function binding
static int LUACALL wx_TestOverLoad_Int(lua_State *L)
{
    wxLuaState wxlState(L);
    wxString returns;
    int argCount = lua_gettop(L);
    int value = (argCount >= 1 ? (int)wxlState.GetNumberType(1) : 0);
returns = wxString::Format(wxT("wx.TestOverLoad(%d) called C Function wx_TestOverLoad_Int"), value);
 lua_pushstring(L, wx2lua(returns) );
    return 1;
}
// a std function binding
static int LUACALL wx_TestOverLoad_String(lua_State *L)
{
    wxLuaState wxlState(L);
    wxString returns;
    int argCount = lua_gettop(L);
wxString value = (argCount >= 1 ? lua2wx(wxlState.GetStringType(1)) : wxEmptyString);
I did a small fix in line above:

    // wxT("") is required instead of wxEmptyString otherwise GCC says:
// ../modules/wxbind/src/wx_bind.cpp:52: error: operands to ?: have different types wxString value = (argCount >= 1 ? lua2wx(wxlState.GetStringType(1)) : wxT(""));

and just committed it; however I wonder: wx_bind.cpp is regenerated by genwxbind.lua... so, adding this code directly in wx_bind.cpp doesn't mean that next time it's regenerated, the code will be lost ?

Francesco



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wxlua-users mailing list
Wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to