lua-users home
lua-l archive

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

Earlier when I said "crashing", it meant "segmentation fault". I suspect its because of misuse of "combine"

I just tried with 5.2.2 and it appears that application is not crashing.
I am also receiving error message as "(c:\work\test2.lua:2: attempt to call global 'call_me' (a nil value))"....I wasn't getting this on 5.2.1

I tried using "combine" with n=2. i.e test2 and call_me ( hoping that its on the stack ). did not work.
I also tried, appending function definition to "return" in test.lua. something like:

str = "return \"function call_me()\\nprint(\\\"how about this?\\\")\\nend\\n\"\n"
load(str)  //it didn't matter if I do load(str)()

when I observe my dumped buffer, I could only see definition of test2().

Apart from this, just for an experiment, I did following thing using c apis:

1: load call_me function //explicitly loading this using c api
2: load test2 function
3: combine() with n=2
4:dump to buffer
5: in different state load this buffer
6: call test2, and we are good


On Fri, Apr 19, 2013 at 12:52 AM, Luiz Henrique de Figueiredo <> wrote:
> I am using Lua 5.2.1 and have problems while dealing with dumped bytecode.

Do these problems remain if you use Lua 5.2.2?

> //Now call "combine", this is the same function which is in luac.c, I am
> using it before I dump.
> //without this lua_dump fails( rather crashes. )
>     combine(L1, 1);

You should not need to use combine, especially with n=1, when it does nothing.
How does lua_dump fail or crash?