Google

main
dspblog
cyclic_signals
FFT_interpolation
FFT_interpolation_how_does_it_work
FFT_smoothness_cyclic
discrete_time_reconstruction
discrete_time_reconstruction2
Nyquist_on_the_edge
FFT_delay_special_case
Fourier_reconstruction
pulse_and_Nyquist
FFT_complexError
matlabOctave
matlab_upsampling
matlab_downsampling
FFT_delay
FFT_filter_example
FFT_interpolation_example
FFT_bin_frequencies
fit_signal
FFT_peaksearch_audio_example
matlab_binary_readwrite
Octavesvg
C
FFTW_example
looprecord
SNR
SNR3
SNR_example_96kAudio
SNR_FFT_correlation_example
lua
luagpib
luasplit
luadump
mnoofltk
wxLuaDll
wxLua_loadAsDll
wxLua_HelloWorld
wxLua_simpleButton
wxLua_resourceManagement
wxLua_XMLparser
DSP
IQ_LO
IQ_LO_2
optimum_receiver
DSP_basics
sampleRateChange_terms
dirac_pulse
freqresp_s
zfilter_example
freqresp_z
freqresp_z_sign
misc
zero_forcing_equalizer_example
nonminphase_inverse
periodic_spectrum
lagrange_multipliers
Entropy
RC_chopper
TRex450_setup
EP100
EP100SE
EP100Gremlins
essential_spares
tail_rotor
motoradjustment
blade_balancing
blade_repair
GAUI_SAE12A
Walkera43


valid html (click to verify)



prevupnextdisable ads

Loading wxLua as library into standard lua interpreter

Summary

wxLua can be loaded as package into a standard lua interpreter using “require”.
wxLua DLLs can be loaded into a standard lua interpreter as library.
This can be preferrable over using the interpreter that comes with wxLua, for example when an existing application is extended with GUI functionality.

The additional DLLs from the wxLua distribution are copied into the same folder as the lua binary.
The application needs to be modified a bit, as the example shows:
  • wxLua needs to be loaded via require (first line)
  • The wxLua main loop is entered using wx.wxGetApp():MainLoop() (last line)

Code

Download
-- ******** Added: Load wxLua library *********
if not wx then require("wx") end

-- standard hello world application
local frame = wx.wxFrame(wx.NULL,
			 wx.wxID_ANY,
			 "wxLua used as library",
			 wx.wxDefaultPosition,
			 wx.wxSize(400, 200),
			 wx.wxDEFAULT_FRAME_STYLE 
		      )


local panel = wx.wxPanel(frame, wx.wxID_ANY)

function OnPaint(event)
   local dc = wx.wxPaintDC(panel)
   dc:DrawText("Hello World", 100, 100);
   dc:delete()
end

panel:Connect(wx.wxEVT_PAINT, OnPaint)
frame:Show(true)

-- ******** Added: Hand over control to wxLua *********
wx.wxGetApp():MainLoop()

Output



prevupnextdisable ads

© Markus Nentwig 2007-2008
The content of this page is provided without any warranty and may not be reproduced without permission.

Comments? Questions?

Please send me a mail! mnentwig@elisanet.fi