|
>> At the moment, the interpreter does not build correct
code from source > >What errors does the compiler give? > >> but the engine does
execute compiled code correctly. > >You mean, code compiled with
luac? >--lhf Here’s a portion of my test code: char test10[] = "a=1;b=2;c=a+b;print(c)"; if ((error = luaL_loadbuffer(L, test10, strlen(test10),
"<test10>")) == 0) { error
= lua_pcall(L, 0, 0, 0); } if (error != 0) { Syslog(loglist,LOG_SEVERE,"Err
in test10: %s",lua_tostring(L, -1)); lua_pop(L,
1);
// pop error message from the stack } Running on the prototype hardware (i.e.68331), the compiler/interpreter
generates no errors, i.e. luaL_loadbuffer returns 0. However, lua_pcall then either
causes a fault or returns a bogus error message like “attempt to perform
arithmetic on a string value”. To track this down, I worked my way down
into the VM code and found that the instructions there do not match what is
generated by the luac compiler running in Visual Studio 6 under Windows 2000
Pro. The first few instructions look good, but the rest is no good (e.g. no
return instruction anywhere). I can compile this lua source on the PC, convert the binary
chunk into a C byte string, build that into the program, and it executes correctly
a few times. BTW, is there a good porting guide somewhere? I need
something for what I call an “embedded” environment; i.e. not
embedded in other software, but embedded in a hardware device with limited
resources. Also, I’m working with version 5.0.2. Thanks very much for the help! Tom |