From: John L. <jr...@us...> - 2005-12-30 04:36:08
|
Update of /cvsroot/wxlua/wxLua/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11092/wxLua/docs Modified Files: readme.txt Log Message: use wxLuaState in addToTrackedMemory, now called wxLua_addToTrackedMemory better docs in wxlstate header rem out wxPrintf debug code fix error recreating wxLuaState, need to Destroy before calling UnRef Index: readme.txt =================================================================== RCS file: /cvsroot/wxlua/wxLua/docs/readme.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** readme.txt 22 Dec 2005 18:42:34 -0000 1.1 --- readme.txt 30 Dec 2005 04:35:59 -0000 1.2 *************** *** 20,29 **** and tables. Perhaps the most powerful feature of the lua language is that the tables can be used as either arrays or as hashtables that can contain numbers, ! strings, and or subtables. wxLua adds to this small and elegant language the power of the wxWidgets cross-platform GUI library. This incudes the ability to create complex user interface dialogs, image manipulation, file manipulation, sockets, displaying ! HTML, and printing. ------------------------------------------------------------------------------- --- 20,29 ---- and tables. Perhaps the most powerful feature of the lua language is that the tables can be used as either arrays or as hashtables that can contain numbers, ! strings, and/or subtables. wxLua adds to this small and elegant language the power of the wxWidgets cross-platform GUI library. This incudes the ability to create complex user interface dialogs, image manipulation, file manipulation, sockets, displaying ! HTML, and printing to name a few. ------------------------------------------------------------------------------- *************** *** 32,39 **** The core of wxLua is based upon a ref counted class called wxLuaState derived from the wxWidget's wxObject class. The wxLuaState class contains as a member ! the 'C' lua_State which is the heart of lua. Since the class is ref counted, ! it should be passed as const wxLuaState& and can be used in much the same way ! as a wxBitmap, wxPen, or any of the other wxObject derived classes that make ! use of it's ref counting. The wxLuaState contains all of the lua 'C' functions, such as --- 32,42 ---- The core of wxLua is based upon a ref counted class called wxLuaState derived from the wxWidget's wxObject class. The wxLuaState class contains as a member ! of it's ref data the 'C' lua_State which is the heart of lua. Since the class ! is ref counted, it should be passed as const wxLuaState& and can be used in ! much the same way as a wxBitmap, wxPen, or any of the other wxObject derived ! classes that make use of it's ref counting. What this means for wxLua is that ! instead of keeping pointers to the lua_State you have instances of the ! wxLuaState. When the lua_State is closed, all the wxLuaStates sharing the ref ! data will now know about it and segfaults from dangling pointers are avoided. The wxLuaState contains all of the lua 'C' functions, such as *************** *** 44,46 **** --- 47,62 ---- it's ref data and the lua_State is created. + It is instructive to follow the creation of the wxLuaState by looking at + bool wxLuaState::Create(wxEvtHandler *handler, wxWindowID id) in + wxLua/modules/wxlua/src/wxlstate.cpp. The lua_State is created using lua_open() + and then the lua libraries are loaded, base, table, string, math, and so on. + Pushed into the lua_State is a light user data of of the wxLuaStateRefData with + the name "__wxLuaStateRefData". This is to allow us to then find the + wxLuaStateRefData "owner" of the lua_State when lua calls a 'C' function, see + wxLuaStateRefData::GetLuaStateRefData. We register print, alert, and traceback + functions to get the output of lua print() statements and send error messages + as wxLuaEvents, see wxEVT_LUA_ERROR. + + After the initial setup, the bindings are registered. + TODO |