lua-users home
lua-l archive

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

Issue 1)
Assuming I have now understood this correctly, for an initial alloc where ptr==NULL then osize is a Lua object enum. For a subsequent realloc call,  it reverts back to being the byte count of the previous alloc. I still think this is a little nasty.
I wish I could persuade the Lua team to put some function header comment blocks into their source. This function could definitely do with a  few notes and a comment describing the params.
Issue 2)
>Your macro _fix_ is really not what you want. Why would you ask if the proposed changes where the best and then completly ignore the answer?

a) Firstly I didnt completely ignore the poster. I replied thanking him for his suggestion
b) I wanted  a C solution, not a Lua solution
c) The C solution was a one liner, the Lua solution was several lines and more complex
Why would you bother to reply just saying the macro fix is wrong, but not explaining your reasoning for that statement ?
Anyway, I tried Peter's suggestion of lua_pushglobaltable(L) instead of lua_getglobal(L,"_G").
Excellent, that worked it fixed the crash I was seeing with the "_G"  solution. Peter's other comment put me onto the reason why I was getting the crash with the "_G" solution. In my init code, I had got the following order.
If I flipped the order of these init functions around so that the base libraries are initialised first, then both solutions worked fine.
I still havent got 5.2 ported and running on my oddball OS, but I am chipping away at the problems slowly, the next crash was in an Sqlite binding. That one was just a cut and paste error once I spotted it. Now Lua is at least running and giving me an error with the require line in my test script. I havent figured that one out yet.
Thanks for the help
Regards Geoff