lua-tilde
lua-tilde copied to clipboard
Use of projects
Maybe I am completely wrong, but I cannot find out how to handle projects in Tilde ! Here are the problems I saw so far :
- The "New Project" menu is grayed.
- The Project window does not seem to accept adding files
- The "Debug | Connect" menu crashes because no project is active
- Visual Studio 2010 can't create project files with the .vcproj extension.
So what is the procedure to start debugging a simple Lua file ?
I really need to document what I have learned about Tilde.
A .vcproj file is required. Obviously, Visual Studio 2010 cannot output .vcproj files anymore, and Tilde was written before .vcxproj and .vcxproj.filters files were invented.
An example file that I use in-game with my old Pathstorm project follows:
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="Pathstorm"
ProjectGUID="{D2A89039-56F7-43F6-BDF6-8A48D7E0F286}"
RootNamespace="Pathstorm"
Keyword="Win32Proj"
>
<Files>
<File RelativePath="..\main.lua"></File>
<File RelativePath="..\Progression.lua"></File>
<Filter Name="ui">
<File RelativePath="..\ui\AchievementsMenu.ui.lua"></File>
<File RelativePath="..\ui\MainMenu.ui.lua"></File>
<File RelativePath="..\ui\QuitDialog.ui.lua"></File>
<File RelativePath="..\ui\SharedInfo.ui.lua"></File>
<File RelativePath="..\ui\TitleScreen.ui.lua"></File>
</Filter>
</Files>
</VisualStudioProject>
Tilde looks files up by checking if the file is relative to the .vcproj. If it does not find it there, it looks it up by .vcproj folder hierarchy. Note that the .vcproj folder hierarchy does not have to resemble the folder hierarchy on the disk, but in the example above, it does.
In my game, I output the compiled binary of the Lua file with an internal filename matching that of the folder hierarchy:
local file = io.open('source/of/ui/MainMenu.ui.lua', 'rb')
local buffer = file:read('*a')
file:close()
local chunk = loadstring(buffer, '@ui/mainmenu.ui.lua')
local outputBuffer = string.dump(chunk)
In LuaPlus, I have an alteration to Tools/Lua/Lua/Lua.cpp that provides the absolute path to the source file. In that manner, Tilde can automatically load the proper absolute filename off the disk. Look for LUA_TILDE_DEBUGGER.
In answer to your other questions:
- The "New Project" menu is grayed.
- The Project window does not seem to accept adding files
It would appear that the original Tilde authors did not add this support before releasing Tilde. I have been unable to contact them via the email addresses posted in their Tilde presentation.
- The "Debug | Connect" menu crashes because no project is active
This can't work without a project, but the crash might be my fault. I recently added the ability to background connect automatically. It is possible I screwed something up