lua-users home
lua-l archive

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

On Thu, May 3, 2018 at 3:41 AM, Viacheslav Usov <> wrote:
On Thu, May 3, 2018 at 7:52 AM, Russell Haley <> wrote:

> So do I rename ...\lua5.1\src\lua.c(h) to  ...\lua5.1\src\lua51.c(h) as well or is that unecessary? I assume I include ...\lua5.1\src\lua.(h) in ...\lua5.x\src\lua.c?

Easiest would be to have a full set of unmodified source files for 5.1 and 5.x in separate directories, say src51 and src5x, then either lua.c will reference lua.h (and everything else) from its own directory. And then tweak those files as described earlier.

> I will need to try to understand why it needs to be static (I'll look that up).

You could try making the pointers not static and see what happens. I'm pretty sure the difference will then be obvious :)

> Here is another question the could only be asked by someone ignorant to C nuances: As an alternative to the above, could I just rename each main() to mainL() and make them NOT static, compile the lua.c files into the lua5x.dll and then just call the appropriate mainL from a new lua.c that I write?

If modifying lua5x.dll is an option, certainly.

Okay, here's a really embarassing thing to have to admit: I actually spent more than 30 seconds looking for a C library to parse options from a command line and another one to read in a config file. Really. I did that while creating a C program to *wrap the lua executable*. 

I'm thinking about creating the following options that that can be run from command line or set by a config file:
- Said -51 option (done)
- a -64bit option. No idea how to do that...
- choose the garbage collector and step
- set the path and cpath
(yes, yes. glorified script file)

Anyway, what I really wanted to converse about is the possibility of putting instrumentation in lua to return various run time data points (e.g. 'how long x takes to execute, how many times function y was called) and then to consider a built in debugger. Does anyone have thoughts on that?