From: John L. <jr...@us...> - 2007-12-20 02:27:03
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8597/wxLua/samples Modified Files: bindings.wx.lua unittest.wx.lua Log Message: - Removed wxluabind_removetableforcall(L) used in the bindings to determine if the function was called from the tables used for class constructors. It makes more sense to call an intermediatary function to remove the table before calling the real function. - Removed the wxLuaFunction class since we no longer need it. It was a userdata with a __call metatable to call the real function we want. We now push the actual function or an overload function helper with the wxLuaBindMethod struct as an upvalue to give better error messages. The new way should be faster since it doesn't generate as much garbage. - Added wxlua_argerror(L, stack_idx, type_str) to give a far more informative message from the bindings when the wrong type is an arg to a function. - Renamed WXLUAARG_XXX to WXLUA_TXXX to match LUA_TXXX. * Do not create a separate overload function in the bindings since we can just as easily check for multiple functions using the wxLuaBindMethod and call the generic overload function or just the single function. Index: bindings.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/bindings.wx.lua,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** bindings.wx.lua 17 Jul 2007 14:45:21 -0000 1.17 --- bindings.wx.lua 20 Dec 2007 02:26:58 -0000 1.18 *************** *** 291,295 **** t = HasBit(t, wxlua.WXLUAMETHOD_OVERLOAD_BASE, nil, nil) -- nobody should care about this t = HasBit(t, wxlua.WXLUAMETHOD_DELETE, s, "Delete") - t = HasBit(t, wxlua.WXLUAMETHOD_OVERLOAD, s, "Overload") t = HasBit(t, wxlua.WXLUAMETHOD_STATIC, s, "Static") t = HasBit(t, wxlua.WXLUAMETHOD_SETPROP, s, "SetProp") --- 291,294 ---- *************** *** 877,891 **** local wxltype_names = { ! "WXLUAARG_None", ! "WXLUAARG_Nil", ! "WXLUAARG_Boolean", ! "WXLUAARG_LightUserData", ! "WXLUAARG_Number", ! "WXLUAARG_String", ! "WXLUAARG_Table", ! "WXLUAARG_Function", ! "WXLUAARG_UserData", ! "WXLUAARG_Thread", ! "WXLUAARG_Integer" } --- 876,891 ---- local wxltype_names = { ! "WXLUA_TNONE", ! "WXLUA_TNIL", ! "WXLUA_TBOOLEAN", ! "WXLUA_TLIGHTUSERDATA", ! "WXLUA_TNUMBER", ! "WXLUA_TSTRING", ! "WXLUA_TTABLE", ! "WXLUA_TFUNCTION", ! "WXLUA_TUSERDATA", ! "WXLUA_TTHREAD", ! "WXLUA_TINTEGER", ! "WXLUA_TCFUNCTION" } Index: unittest.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/unittest.wx.lua,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** unittest.wx.lua 13 Dec 2007 00:47:53 -0000 1.18 --- unittest.wx.lua 20 Dec 2007 02:26:59 -0000 1.19 *************** *** 90,94 **** end ! PrintOk(wxlua.WXLUAARG_Nil == -2, "Test wxlua bindings wxlua.WXLUAARG_Nil == -2") -- --------------------------------------------------------------------------- --- 90,94 ---- end ! PrintOk(wxlua.WXLUA_TNIL == -2, "Test wxlua bindings wxlua.WXLUA_TNIL == -2") -- --------------------------------------------------------------------------- *************** *** 212,216 **** -- Test new() constructor function and copying it f = wx.wxImage.new ! PrintOk(f(5,5):Ok(), "Calling wx.wxImage.new(5,5) function as constructor.") -- Test calling a baseclass function a few levels deep --- 212,222 ---- -- Test new() constructor function and copying it f = wx.wxImage.new ! PrintOk(f(5,6):Ok(), "Calling wx.wxImage.new(5,6) function as constructor.") ! ! f = wx.wxImage(5,6) ! g = f.GetWidth ! PrintOk(type(g) == "function", "Type f = wx.wxImage(5,6); f.GetWidth is a function.") ! ! PrintOk(g(f) == 5, "Calling f = wx.wxImage(5,6); g = f.GetWidth; g(f) == 5; function is callable outside of userdata.") -- Test calling a baseclass function a few levels deep |