I have some problems using wxLua in LuaLateX.

This works:

lua simpleui.lua

(print instead of tex.print)

But if I try this:

lualatex wx.tex

it doesn't work.


  {\Huge\color{\ChoicewxRadioBox} Test!}


enter image description here



frame = nil

function HandleEvents(event)
  local name = event:GetEventObject():DynamicCast("wxWindow"):GetName()
  print(string.format("\\global\\def\\Choice%s{%s}", name, event:GetString()))

function main()
  frame = wx.wxFrame(wx.NULL,
                     "Erstellen Sie Ihr PDF-Dokument mit LuaTeX",
                     wx.wxSize(185, 85),
  local panel = wx.wxPanel(frame, wx.wxID_ANY)
  local choices = {"blue", "red", "green"}
  local radioBox = wx.wxRadioBox(panel,
                                 choices, 1,wx.wxRA_SPECIFY_ROWS)



The folder contains the following files:

  • lua51.dll
  • lua5.1.dll
  • simpleui.lua
  • wx.tex
  • wx.dll

I am using Lua 5.1 and LuaTeX beta-0.70.2 (MikTeX 2.9).

texlua simpleui.lua doesn't work:

enter image description here

The example is on page 24:


Edit: I was able to compile the wxlua libs on Linux and it works, but i still haven't any solution for windows.

  • 4
    Welcome to TeX.SE! The information you've provided so far is a bit sparse. What does the file simpleui.lua contain, and where is it located? Is wxLua a precompiled library? Which versions of Lua and luatex do you use?
    – Mico
    Commented May 18, 2014 at 9:09
  • 2
    I can't get wxLua to compile, so just few thoughts. What is the output when you try to run texlua simpleui.lua? This will use same interpreter as lualatex as opposed to lua, which may be different version of interpreter. Also, what about running the gui with lua, generate the document on the fly and call lalatex from here? I have a feeling that it would be easier to maintain.
    – michal.h21
    Commented May 19, 2014 at 12:16
  • I can't get wxLua to compile on linux too. ^^ I am going to try the command and add the result to my question. There is no need to run the gui in pure lua, i just want to try, what is possible directly in lualatex.
    – SLx64
    Commented May 19, 2014 at 18:44
  • 1
    I have a MacBook and thus can't replicate your Windows-based setup. It looks to me like lua and luatex aren't looking for compiled libraries in the same places.
    – Mico
    Commented May 20, 2014 at 5:16
  • I've tried VCLua on Windows and got the same error. I can't find the VCLua library or the source for Linux -.-
    – SLx64
    Commented May 20, 2014 at 9:11

1 Answer 1


The german message says %1 is not a valid Win32 application.

May be you first quickly check all your wx module files (may be `wc*.*' ?), if they look like the ususal DLL files.

It is quite possible that you have different environment settings (especially PATH) when running lua directly and when lua is executed inside the luatex.

Then different versions may be found of 1. what was already loaded in the moment (DLL files and the lua itself), 2. what is going to be loaded.

Take control of that.

Longer answer starts by suggestion to find of what various version of DLL files you have (including the lua.exe itself versus the built lua in luatex.)

Then you should compare the environment variables on your command line and those that are available to DLL started by luatex. May simply execute the command prompt (interactivelly or not) from inside luatex. Create AAA.BAT containing

echo I AM HERE
echo I-would  lua someprog.lua
ehoo I-would  lua simpleui.lua

and make it executed from inside of your TeX file. Check you see I AM HERE, meditate about what SET outputs and then start testing what happens if you remove echo I-would -- for some simple someprog.lua first.

Also the two files lua51.dll, lua5.1.dll might be part of the problem. Loading DLL's in the current directory can be sometimes done and sometimes not.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .