Update of /cvsroot/wxlua/wxLua/samples
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22340/samples
Added Files:
luamodule.wx.lua
Log Message:
added luamodule
--- NEW FILE: luamodule.wx.lua ---
-----------------------------------------------------------------------------
-- Name: luamodule.wx.lua
-- Purpose: Minimal wxLua sample for use as a lua module using require
-- Author: John Labenski
-- Modified by:
-- Created: 05/13/2006
-- RCS-ID:
-- Copyright: (c) 2001 John Labenski. All rights reserved.
-- Licence: wxWidgets licence
-----------------------------------------------------------------------------
-- find the PATH where the "wx" module of wxLua has been installed (Unix-only)
-- tmpfilename = os.tmpname()
-- os.execute("pkg-config wxlua --variable=libdir >"..tmpfilename)
-- for line in io.lines(tmpfilename) do package.cpath = line.."/lua/5.1/?.so" end
package.cpath = ";;../lib/?.so;..\lib\?.dll"
require("wx")
-- simple test of Non GUI elements
p = wx.wxPoint(1,2)
print("The point is", p:GetX(), p:GetY())
frame = wx.wxFrame(wx.wxNull, -1, "wxLua module sample")
-- create a simple file menu so you can exit the program nicely
local fileMenu = wx.wxMenu()
fileMenu:Append(wx.wxID_EXIT, "E&xit", "Quit the program")
local menuBar = wx.wxMenuBar()
menuBar:Append(fileMenu, "&File")
frame:SetMenuBar(menuBar)
frame:ConnectEvent(wx.wxID_EXIT, wx.wxEVT_COMMAND_MENU_SELECTED,
function (event) frame:Close(true) end )
frame:Show(true)
-- ALWAYS call wx.wxGetApp():MainLoop() last to keep the program active
-- otherwise the lua program will exit immediately
wx.wxGetApp():MainLoop()
|