Search code examples
luazerobrane

Lua crashes when compiling test program


I'm looking to dip my toes into coding with Lua - I'm trying to find something to teach my 11-year-old son some programming skills (he's already mastered Scratch :) ). I'm completely new to Lua myself, but I have some background in other languages.

I've downloaded and installed ZeroBrane (v0.80 running on OS X 10.9.5); however, when I try to compile/run any of the sample files the test program turtle.lua, I get a crash:

enter image description here

The same happens if I choose Lua 5.2 as the interpreter. Any ideas as to the possible cause and fix?

EDIT: I was a bit hasty when testing this before; simple Lua code appears to run fine, as do the sample programs in the turtle-samples folder.

The sample code spirograph.lua runs without crashing, but doesn't appear to actually do anything. Turtle.lua still crashes: by stepping through the code, it appears to crash when exiting the loop between lines 543 and 555:

enter image description here

If I press F10 at this breakpoint, I get the Lua crash.


Solution

  • Both turtle.lua and spirograph.lua files are modules, so you don't need to "run" them as they don't do anything by themselves. You can run all the included examples, and those that use those modules run without issues.

    Thank you for debugging it; I'll check what may be causing a crash on turtle.lua, but you can continue using it as a module without issues.