Lua Debugging?

View previous topic View next topic Go down

Lua Debugging?

Post  BenSS on Thu Jun 11, 2009 1:43 pm

I've run through Tutorial 10 and attached a very simple Lua script to a SIO2 project. However, it keeps crashing when I run it in the simulator. What's the suggested method of debugging the lua script? Cutting out part of the script till you find the problem line seems inherently tedious and there has to be a better way, especially since I currently only have one critical line.


If interested, it fails at this line in ldo.c:
status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc);

All I'm doing is reusing 10's example, cutting render down to (I'll be using the vector for a calculation if I get it to run):
function Cube.render()
Cube.vec = Cube.obj._SIO2transform.rot;
end

BenSS

Posts : 2
Join date : 2009-06-11

View user profile

Back to top Go down

Re: Lua Debugging?

Post  yarri on Fri Jun 12, 2009 11:40 am

Hi, lots of empathy for you... I wound up using good old printf's! Lua does log errors to the console but it was hard to interpret parsing errors versus logic errors. I wound up using the on-line Lua engine for some syntax checking:
http://www.lua.org/demo.html

And you might want to try something like Ldb:
http://www.tecgraf.puc-rio.br/~tomas/ldb/

--yarri

PS: I posted my Lua steering port to this forum, my code works on both sim and device so it might give you another reference point in addition to the tutorial

yarri

Posts : 81
Join date : 2009-04-10

View user profile

Back to top Go down

Re: Lua Debugging?

Post  BenSS on Thu Jun 18, 2009 1:35 pm

Thanks, that helps at least but it's tedious sometimes getting it to work. Feels very old-school!

Currently trying to figure out why adding any lua script to my current project crashes it now, even tried one with only comments!

BenSS

Posts : 2
Join date : 2009-06-11

View user profile

Back to top Go down

Re: Lua Debugging?

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum