Lua code parsing
Lua code parsing
Good evening,
I have created a workspace that contains a single project, and that project contains a single .lua file.
The "functions" list appears to be empty, while the classes list contains a mixed list of variables and function names.
Any idea why this is happening?
Thanks
Terry
I have created a workspace that contains a single project, and that project contains a single .lua file.
The "functions" list appears to be empty, while the classes list contains a mixed list of variables and function names.
Any idea why this is happening?
Thanks
Terry
Hi Terry,
It appears you have found a bug
Just FYI This is how the functions list works.
If the current file is in the current workspace the tag information is used to populate the function list, other wise the function regular expression in the document type is used.
In this case the file is in the workspace, but what has gone wrong is the tagger has incorrectly marked the functions as variables and hence the error.
Hopefully I suspect this should be fairly easy to fix so watch this space for patch
Cheers Jussi
The "functions" list appears to be empty, while the classes list contains a mixed list of variables and function names.
It appears you have found a bug

Just FYI This is how the functions list works.
If the current file is in the current workspace the tag information is used to populate the function list, other wise the function regular expression in the document type is used.
Any idea why this is happening?
In this case the file is in the workspace, but what has gone wrong is the tagger has incorrectly marked the functions as variables and hence the error.
Hopefully I suspect this should be fairly easy to fix so watch this space for patch

Cheers Jussi
There is a new xtags.dll that should fix this issue. Just download the this zip file and replace the current dll with the one from the zip file.
Cheers Jussi
Cheers Jussi
re: new xtags.dll
Jussi,
That fixed the problem. Thank you for the quick turnaround!
Have a great day/evening!
Terry
That fixed the problem. Thank you for the quick turnaround!
Have a great day/evening!
Terry
Lua Code Completion
Hello jussij,jussij wrote:There is a new xtags.dll that should fix this issue. Just download the this zip file and replace the current dll with the one from the zip file.
Cheers Jussi
I am having a similar problem to what tbayne was having except, replacing the xtags.dll file did not seem to resolve the issue.
That is, I created a single workspace with a single project with a single .lua file for the API excerpted below for your reference.
Code: Select all
crypto.sha512
display.captureScreen ( <#saveToAlbumBool#> )
display.contentCenterX
display.contentCenterY
display.contentHeight
display.contentScaleX
display.contentScaleY
display.contentWidth
display.getCurrentStage ( )
display.loadRemoteImage ( <#url#>, <#method#>, <#listener#> <#[, params]#>, <#destFilename#> <#[, baseDir]#> <#[, x, y]#> )
display.newCircle( <#xCenter#>, <#yCenter#>, <#radius#> )
Further, the Functions list appears to be empty.
Thanks in advance.
John
Hi John,
Correct me if I am wrong, but in your code below you are using the functions that make up the display table:
Why this is not working is because nowhere in your code is there a definition of the display table.
Without somesort of definition, there is no ctags information, hence Zeus knows nothing about the object and as such it can't show any of it's functions.
But luckily there is quite an easy to fix this
Can you try doing the following:
To find the corrent location just use the Macro, Load menu and in the resulting dialog move up one folder level to help the correct zTags folder location.
So how does this all work
Well the steps above do nothing more than create a very simple definition of the display object.
This display object definition has also been saved to the Lua tag database that is attached to this Lua workspace.
Also the default definition of the Lua document type has been pre-defined to use this Lua tag database.
So this means any time you edit any Lua file, Zeus will go looking into this tag database for any object definitions.
But you will notice one final trick
The object definition has been put into a Java Script file and not an Lua file.
This has to be done because the ctag.exe does not fullly support modern day Lua code.
But since we only require a very simple skeleton of the object definition we can get away with just a little bit of Java Script to provide the definition
Cheers Jussi
Correct me if I am wrong, but in your code below you are using the functions that make up the display table:
Code: Select all
display.captureScreen ( <#saveToAlbumBool#> )
display.contentCenterX
Without somesort of definition, there is no ctags information, hence Zeus knows nothing about the object and as such it can't show any of it's functions.
But luckily there is quite an easy to fix this

Can you try doing the following:
- I am assuming you are running Windows XP (see below if this is not the case)
- Create a new workspace called Lua in the following folder location.
Code: Select all
c:\Program Files\Zeus\zTags\
- Remove the Header and Resource folders.
- Add this file (which should already exist) to the Source folder of that workspace:
Code: Select all
c:\Program Files\Zeus\zTags\Templates\Lua.js
- Append this code to the end of that file:
Now if you create a new Lua file and type in this code:
Code: Select all
// Created using http://developer.anscamobile.com/reference/display-objects class display { // Common Methods remove(); // Content Size Properties contentCenterX; contentCenterY; contentHeight; contentScaleX; contentScaleY; contentWidth; screenOriginX; screenOriginY; statusBarHeight; viewableContentHeight; viewableContentWidth; //Factory Functions loadRemoteImage( ); newCircle(); newEmbossedText(); newGroup(); newImage( ); newImageRect(); newLine( ); newRect(); newRetinaText(); newRoundedRect(); newText(); //Other Display Functions captureScreen( ); save( ); setDefault( ); setStatusBar( ); //Stage Display Objects getCurrentStage( ); }
- You should get the correct intellisense as expected.
Code: Select all
display.
To find the corrent location just use the Macro, Load menu and in the resulting dialog move up one folder level to help the correct zTags folder location.
So how does this all work

Well the steps above do nothing more than create a very simple definition of the display object.
This display object definition has also been saved to the Lua tag database that is attached to this Lua workspace.
Also the default definition of the Lua document type has been pre-defined to use this Lua tag database.
So this means any time you edit any Lua file, Zeus will go looking into this tag database for any object definitions.
But you will notice one final trick

The object definition has been put into a Java Script file and not an Lua file.
This has to be done because the ctag.exe does not fullly support modern day Lua code.
But since we only require a very simple skeleton of the object definition we can get away with just a little bit of Java Script to provide the definition

Cheers Jussi
Last edited by jussij on Wed Jan 11, 2012 2:19 am, edited 1 time in total.
Lua Code Completion
Hello Jussi,
Thanks for your prompt reply and detailed set of instructions and explanation for my issue.
I will work through your set of steps and report back to you on the results.
Again, thanks for your help.
John
Thanks for your prompt reply and detailed set of instructions and explanation for my issue.
I will work through your set of steps and report back to you on the results.
Again, thanks for your help.
John
Hi John,
I found a better reference page for the Corona SDK API and have create a better reference file.
See details here: http://www.zeusedit.com/zforum/viewtopic.php?t=6528
This is just a very quick, first cut so I am sure it will have a few bugs.
Cheers Jussi
I found a better reference page for the Corona SDK API and have create a better reference file.
See details here: http://www.zeusedit.com/zforum/viewtopic.php?t=6528
This is just a very quick, first cut so I am sure it will have a few bugs.
Cheers Jussi