49

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.

\documentclass{article}
\directlua{require("simpleui.lua")}
\usepackage{color}

\begin{document}
  {\Huge\color{\ChoicewxRadioBox} Test!}
\end{document}

Error:

enter image description here

simpleui.lua:

require("wx")

frame = nil

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

function main()
  frame = wx.wxFrame(wx.NULL,
                     wx.wxID_ANY,
                     "Erstellen Sie Ihr PDF-Dokument mit LuaTeX",
                     wx.wxDefaultPosition,
                     wx.wxSize(185, 85),
                     wx.wxDEFAULT_FRAME_STYLE)
  local panel = wx.wxPanel(frame, wx.wxID_ANY)
  local choices = {"blue", "red", "green"}
  local radioBox = wx.wxRadioBox(panel,
                                 wx.wxID_ANY,
                                 "Farbe",
                                 wx.wxDefaultPosition,
                                 wx.wxDefaultSize,
                                 choices, 1,wx.wxRA_SPECIFY_ROWS)
  frame:Connect(wx.wxID_ANY,
                wx.wxEVT_COMMAND_RADIOBOX_SELECTED,
                HandleEvents)
  frame:Show(true)
end

main()

wx.wxGetApp():MainLoop()

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:

http://www.dante.de/events/Archiv/dante2012/Programm/Vortraege/vortrag-meigen.pdf

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 May 18 '14 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 May 19 '14 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 May 19 '14 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 May 20 '14 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 May 20 '14 at 9:11

protected by Community May 11 '17 at 18:44

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Browse other questions tagged or ask your own question.