lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


----- Original Message -----
From: HyperHacker
Date: 8/25/2011 6:02 PM
On Thu, Aug 25, 2011 at 17:18, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br>  wrote:
So I started thinking about how to coax Lua into doing this _and_ allow
a Lua debugger to still work.
It would be nice to feed this to Lua (or equivalent):

#line 1 "fileA.lua"
local MY_DEFINE = 5
#line 2 "fileA.lua"
local YOUR_DEFINE = 10
#line 1 "fileB.lua"
print(MY_DEFINE)
#line 2 "fileB.lua"
You could actually run Lua files through the C preprocessor for true
#define support.

I could (and have the Lua module mcpp to help me do this). However, this doesn't allow easy lookup of a symbol's value in the debugger. For the above, I can see what MY_DEFINE is as I am stepping over the line.

Of course, #include is a worse problem, as line numbers will be off for the file.

#define for expansion of source code is really convenient at times. Using the technique Luiz shows in the other email could ameliorate the line numbering problem.

Anyway, I may have to use a full preprocessor anyway. I was just hoping to use an all Lua technique that would allow for symbol resolution.

Thanks!

Josh