Windows 10 Zeus crash with Lua

If reporting a bug with the Zeus IDE please post the details here. Please do not post questions here.
Post Reply
kmhappel
Posts: 2
Joined: Wed Dec 14, 2016 2:12 am

Windows 10 Zeus crash with Lua

Post by kmhappel »

The program resists saving files asking if you want to discard changes left in the editor when there are none known. Several save attempts causes Zeus crash. Using your Lua compiler and an add-in middleclass.lua for oop programing. Zeus version 3.98h. Windows 10 home version 1607

This shows up in the debug window.
...Owner\AppData\Roaming\Xidicone\Zeus\zScript\lua_exec.lua:65: bad argument #1 to 'remove' (string expected, got function)Macro script generated '1' Debug, Error and/or Warning message(s).
"zfwdoc01.cpp" (1543)
"zfwdoc01.cpp" (1543)
"zfwdoc01.cpp" (1543)
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: Windows 10 Zeus crash with Lua

Post by jussij »

Using your Lua compiler
Zeus comes with an Lua interpreter as shown below:

Code: Select all

C:\Program Files (x86)\Zeus>lua52.exe -v
Lua 5.2.0  Copyright (C) 1994-2011 Lua.org, PUC-Rio
But that interpreter is only used to do the Lua syntax checking and to run external Lua code.

It is only provided for the sake of simplicity and can be remove if required.

But if you do remove that lua52.exe file then you will need to edit the Lua Document type and in the Compiler section change the compiler command line.

The defauult command line is shown below, which as you can see is using this default Zeus Lua interpreter:

Code: Select all

lua52.exe -v -p "$fn"
You will also need to edit the zScript/lua_exec.lua file and change this line of Lua code:

Code: Select all

-- the 'run script' command will use tee to capture the output to a file
local cmd = "lua52.exe " .. file_name .. " 2>&1 | tee " .. file_output
Just change those two command lines to match whatever Lua interpreter you wish to use.
This shows up in the debug window.
...Owner\AppData\Roaming\Xidicone\Zeus\zScript\lua_exec.lua:65: bad argument #1 to 'remove' (string expected, got function)Macro script generated '1' Debug, Error and/or Warning message(s).
This error message is highlighting a bug in the lua_exec.lua Zeus script :oops:

From within Zeus create a new, empty document and into that document paste in this text:
lua_exec.lua:65
With the cursor on that line, use the View, Open File 'lua_exec.lua' menu to load that file at the correct line location.

Now change this broken Lua code:

Code: Select all

   -- remove the output file
   os.remove(file_output_ex)
changing it to this correct Lua code:

Code: Select all

   -- remove any previous output file
   os.remove(file_output)
This should stop the error message described earlier from happening.

Cheers Jussi
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: Windows 10 Zeus crash with Lua

Post by jussij »

With regard to using the middleclass.lua library found here: https://github.com/kikito/middleclass/

The link above contains the following example Lua code:

Code: Select all

local class = require 'middleclass'

local Fruit = class('Fruit') -- 'Fruit' is the class' name

function Fruit:initialize(sweetness)
  self.sweetness = sweetness
end

Fruit.static.sweetness_threshold = 5 -- class variable (also admits methods)

function Fruit:isSweet()
  return self.sweetness > Fruit.sweetness_threshold
end

local Lemon = class('Lemon', Fruit) -- subclassing

function Lemon:initialize()
  Fruit.initialize(self, 1) -- invoking the superclass' initializer
end

local lemon = Lemon:new()

print(lemon:isSweet()) -- false
Save this code to a c:\temp\test.lua file.

To compile and run this code in Zeus make sure you download the middleclass.lua file from the link above and make sure it is save to the zScript folder.

You can locate zScript folder using the Tools, DOS Command Line menu and running this command:

Code: Select all

dir $zScript
Then with the c:\temp\test.lua file as the active document, run the code using the Macros, Execute menu and you will then see the expected false output.

The next Zeus release will also include a change to allow the middleclass.lua file to live in the same folder as the file being executed.

Cheers Jussi
kmhappel
Posts: 2
Joined: Wed Dec 14, 2016 2:12 am

Re: Windows 10 Zeus crash with Lua

Post by kmhappel »

Thanks so much... the bug fix worked... I had already figured out the zScript position for middle class. Do all extensions go there until next release?

Love the product

I am unable to get CVS going at all. Doxygen doesn't function either... seems the lack of .h and .c file throws it into a fit.... I read and followed your instructions letter for letter according to the setup guide and your knowledgebase... Do you have any suggestions.
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: Windows 10 Zeus crash with Lua

Post by jussij »

Do all extensions go there until next release?

I have not tested this, but I think if you setup a system wide LUA_PATH as shown below that should also work:

Code: Select all

LUA_PATH=.\\?.lua;
Naturally you can point that LUA_PATH to point any any set of folders tat you like.
I am unable to get CVS going at all. Doxygen doesn't function either... seems the lack of .h and .c file throws it into a fit....

I will do some testing of these two features just to make sure they still work. These features were added to Zeus many years ago so it might be they have some issues with Windows 10 :?

The issue with Doxygen might be it doesn't work with Lua code.

I've only every used Doxygen with C, C++ and C# code and the last time I tried using it for such code I found it work well.

Cheers Jussi
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: Windows 10 Zeus crash with Lua

Post by jussij »

As I suspect Doxygen does not support Lua straight out of the box:

https://www.stack.nl/~dimitri/doxygen/helpers.html

I tried the first Doxygen filter for Lua listed on that page which can be found here:

https://github.com/alecchen/doxygen-lua

But when I tried to run the make command if failed:

Code: Select all

C:\Temp\Lua>perl Makefile.PL
Can't locate inc/Module/Install.pm in @INC (you may need to install the inc::Mod
ule::Install module) (@INC contains: C:/Utilities/Perl/perl/site/lib C:/Utilitie
s/Perl/perl/vendor/lib C:/Utilities/Perl/perl/lib .) at Makefile.PL line 1.
BEGIN failed--compilation aborted at Makefile.PL line 1.
So it should be possible to make Doxygen work with Lua but this particular GitHub code dates back to 2010 so it may no longer work :(

Cheers Jussi
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: Windows 10 Zeus crash with Lua

Post by jussij »

I found a more recent version of this package here: http://annocpan.org/~ALEC/Doxygen-Lua-0.04

But the next step of the install fails because I have no make tool installed.

So I suspect this package is designed to work on Linux and lot on Windows.

Cheers Jussi
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: Windows 10 Zeus crash with Lua

Post by jussij »

I found a Doxygen Lua filter that works :)

The details can be found here: viewtopic.php?t=7597

Cheers Jussi
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: Windows 10 Zeus crash with Lua

Post by jussij »

I am unable to get CVS going at all.

I can confirm that the CVS plug-in is currently not working.

This should be fixed by the time of the next release due at the end of the month.

Cheers Jussi

PS: For an alternative source control option there is also the Agent SVN Subversion plug-in found here.

This plug-in is known to work since it is actively used in the Zeus software development process ;)
Post Reply