Menu

wxLua 2.8.7.0 released

We are pleased to announce the latest release of wxLua.

-------------------------------------------------------------------------------
wxLua is a Lua scripting language wrapper around the wxWidgets cross-platform
GUI library. It consists of an executable for running standalone wxLua scripts
and a library for extending C++ programs with a fast, small, fully embeddable
scripting language.

References:
http://wxlua.sourceforge.net
http://www.lua.org
http://www.wxwidgets.org

-------------------------------------------------------------------------------
The wxLua "big picture"

Lua is an ANSI C compatible scripting language that can load and run
interpreted scripts as either files or strings. The language itself is very
dynamic and contains a limited number of data types, mainly numbers, strings,
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.

-------------------------------------------------------------------------------

Notes:
Major update to the C/C++ API of wxLua. See changelog for more information.

wxLua-2.8.7.0-MSW-bin.zip : static linked executables for MS Windows
that do not rely of DLLs.

wxLua-2.8.7.0-MSW-dll.zip : dynamically linked executables for MS
Windows including wx.dll for using with Lua's require("wx") function.

Changes:
version 2.8.7.0 (released 02/02/2008)
--------------------------------------------------------------------

- Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool
"registerClasses" since it didn't do anything useful anyway.
If there needs to be a way to reregister the wxLua functions it should
to be implemented from the ground up.
- Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to
search for their usage. The functions in the wxLuaState used to be
called just "txxx" and are now called wxluaT_Xxx where the first
letter of each word is capitalized for searching.
- Made wxluaT_insert(L, idx) not pop the value that it refs since
it may not be the one at the top of the stack.
- Made wxLuaCheckStack class work a little nicer for easier debugging in C++.
- Use wxSIGKILL to kill debuggee process since wxSIGTERM doesn't work in MSW.
- wxLuaStackDialog has better search for all columns, collapse and expand
tables, and show metatables. It also now uses a virtual wxListCtrl so
it's much faster. You can expand both key and values of a table and
more information is provided about items wxLua knows about.
- Separated the "tags" for C++ classes from "refs" for objects we want a
handle on in the Lua registry by putting them in separate tables.
- Removed wxlua_pushkey_XXX #defines since we now have a few tables in the
registry that we use and those methods were not useful anymore.
The lightuserdata keys are now const char* strings with a descriptive name,
however it is the mem address that is used as the table key.
- wxluaT_newtag() now leaves the created table on the stack.
- Removed wxluaT_newweaktag() and wxluaT_settagmethod() since they were
not needed anymore.

* A large portion of the internal workings of the wxLuaState have been
rewritten. All of the data that was stored in wxLuaStateData that might
be needed by a function taking a lua_State* is now in the
LUA_REGISTRYINDEX. C functions have been added to access these values.
The generated bindings no longer need to have "wxLuaState wxlState(L);"
since everything can be done with the C functions.
The result is that wxLua should be faster.

- Applied patches to Lua 5.1.2 #8-11
lua_setfenv may crash if called over an invalid object.
- Made the garbage collector more aggressive since we push void* pointers
but the data behind them may be quite large. Unfortunately there is no
mechanism to give a size hint to Lua without modifying Lua.
lua_gc(L, LUA_GCSETPAUSE, 120); lua_gc(L, LUA_GCSETSTEPMUL, 400);
- Added wxLuaArtProvider with virtual functions to create custom
wxArtProviders in Lua.

* Allowed using wxObject:DynamicCast() on an object and be able to use the
object as both types. The problem was that wxEvent:GetEventObject()
returned a wxObject which overwrote the wxWindow (perhaps) that you had as
a userdata in Lua already.
Additionally, if you delete an object all of the userdata that wrap it
have their metatables cleared for safety.

Functions renamed since they don't do the same thing or behave the same.
wxluaO_istrackedobject -> wxluaO_isgcobject
wxluaO_addtrackedobject -> wxluaO_addgcobject
wxluaO_removetrackedobject -> wxluaO_deletegcobject

- Created a central luauserdata:delete() function for the bindings to reduce
code. wxLua_userdata_delete(L)
* Changed signature of the function wxLuaState::SetLuaDebugHook() so that
the inputs to lua_sethook() are together and in the same order.
- Renamed wxLuaCallback to wxLuaEventCallback to make it more clear that
it is a callback for the wxEvents using wxEvtHandlers.

- 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.

* Updated the naming conventions of the wxLua C/C++ functions to get rid of
the term "tag" which dates back to Lua 4. Lua 5 does not use "tags", but
rather metatables to attach functions to userdata in Lua.
The new term for the C++ objects that wxLua wraps in Lua userdata and
assigns a metatable to are wxLua types.
WXLUA_TXXX types < WXLUA_T_MAX correspond to the LUA_TXXX Lua types.
wxLua types > WXLUA_T_MAX are types from the bindings and denote a
class or struct.
- Most notably for people who have written their own overrides for their
bindings will be that wxLuaState::PushUserTag() is now
wxluaT_PushUserDataType().
Those two functions existed before, but basically did the same thing.
The calling arguments of PushUserTag() were taken however and were the
reverse of what PushUserDataType() had.
- wxluaT_new/get/set/tag() are now wxluaT_new/setmetatable() and
wxluaT_type() where the latter works just like lua_type(), but returns
one of the wxLua types.

- Fix crash in wxListCtrl and wxTreeCtrl::AssignImageList() to use the
%ungc tag to release wxLua from deleting the input wxImageList.
- Added image sample translated from C++ by Hakki Dogusan.

* Changed wxLuaState_Type enum for wxLuaState(lua_State*, wxLuaState_Type)
Removed wxLUASTATE_USESTATE and you now | together wxLUASTATE_SETSTATE with
wxLUASTATE_OPENBINDINGS if you want the bindings opened.
Cleans up the creation of the wxLuaState so a precreated lua_State
should be able to be used easier.
- Remove poorly named wxLuaState::LuaError() and CheckRunError() and
replaced them with the C functions wxlua_errorinfo() and wxlua_LUA_ERR_msg()
respectively.
- Added wxlua_pushargs(wxChar**, int) for a standard way to push args
into Lua.
- Copy Lua's print() function to print_lua() instead of simply
overwriting it in case someone really wants to use it.

- Revised the build system, specially the configure script under Linux which
now accepts more options and automatically detects the presence/absence of
each wxWidgets library when --enable-wxbind* options are left in "auto" mode

* Updated Lua to 5.1.3

- Added static bool wxLuaState::sm_wxAppMainLoop_will_run so that Lua code
that calls "wx.wxGetApp:MainLoop()" will not do anything. C++ coders
should call it if they create a wxLuaState and run Lua code from
their wxApp:OnInit() when wxApp:IsMainLoopRunning() returns false.
See the apps for usage.

* The wxLua type numbers are now generated when the first wxLuaState is created
rather then when the bindings are registered into Lua. This means that
each wxLua type stays the same for the life of the program no matter what
bindings are installed or in what order.
- The copy of the wxLuaBindingList in the wxLuaState was removed since it is
no longer needed. Renamed the functions static wxLuaBinding::GetBindXXX()
to FindBindXXX() since they no longer needed the extra
wxLuaBindingList parameter
and they had the same signature as the existing GetBindXXX() functions.
Removed the wxLuaBinding::Clone() function as it is no longer used.
- Added wxLuaState::RegisterBinding(wxLuaBinding*) function to register
single bindings at a time. You may also reregister bindings, which means
that their metatable functions are simple rewritten.

- Removed the wxLuaBinding::PreRegister() and PostRegister() functions and
made RegisterBinding() virtual
Note: wxLuaBinding::RegisterBinding() now leaves the Lua table that the
binding objects were installed into on the stack. You must pop it.
* The rules.lua for genwxbind.lua now uses wxLuaBinding_class_declaration and
wxLuaBinding_class_implementation to replace wxLuaBinding_preregister and
wxLuaBinding_postregister. You may now add whatever you like to the class
declaration and implementation source code.

- Updated bitlib to version 25.

Posted by Francesco Montorsi 2008-02-03

Log in to post a comment.