| 
      
      
      From: Hakki D. <dog...@tr...> - 2006-12-12 08:52:26
      
     | 
| Hi, John Labenski wrote: > First off, I'm going to rename some rather unfortunately named > functions. These are mostly internal to wxLua, but you may have to > rebuild your bindings using genwxbind.lua. > > More importantly, do we want stricter function parameter type > checking. Lua itself is very generous and will convert numbers to > strings, nil to number, etc... BUT, this means that without some > checking you can spend a lot of time debugging a small typo since vars > can be created on the fly with the value nil. > > Lua has nice functions, tostring(X), tonumber(X), and nil can be > avoided using "nil or value". > > Below is what we currently accept for different variable types and > what I propose I marked with a * > > See here > http://wxlua.cvs.sourceforge.net/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp?view=markup > > wxLua_lua_isstringtype > case LUA_TNIL: * MAKE INVALID can use [str or ""] Ok. > case LUA_TSTRING: > case LUA_TNUMBER: // can convert easily > > wxLua_lua_isbooleantype > case LUA_TNIL: > case LUA_TNUMBER: > case LUA_TBOOLEAN: > > wxLua_lua_isenumerationtype > case LUA_TNUMBER * check to see if it's an INT? probably not If you can't check that it is really an enum value, why bother? wx itself accepts int for enum? ex: // Bitmap flags enum wxBitmapType { wxBITMAP_TYPE_INVALID, // should be == 0 for compatibility! wxBITMAP_TYPE_BMP, wxBITMAP_TYPE_BMP_RESOURCE, ... wxBITMAP_TYPE_ANY = 50 }; wxImage(const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1) > > wxLua_lua_isnumbertype > case LUA_TNIL: * MAKE INVALID can use [num or 0] Ok. > //case LUA_TSTRING: // will be 0 unless really a number "2" > case LUA_TNUMBER: > case LUA_TBOOLEAN: > > Thoughts? > John Labenski > -- Regards, Hakki Dogusan |