When my Lua program stops running, I connect to the LS300 with DevStudio and it shows Lastexitcode 35584, Lastexittype EXIT_ERROR.

How can I use this exit code to troubleshoot this runtime code?

The exit code displayed in the variable “Lastexitcode” is the raw status value as returned by the posix function waitpid() (man waitpid on linux to have full spec)
From this raw value (35584 = 0x8B00) we can get some information.
extracted from waitstatus.h:

/* If WIFEXITED(STATUS), the low-order 8 bits of the status.  */
#define	__WEXITSTATUS(status)	(((status) & 0xff00) >> 8)

/* If WIFSIGNALED(STATUS), the terminating signal.  */
#define	__WTERMSIG(status)	((status) & 0x7f)

/* If WIFSTOPPED(STATUS), the signal that stopped the child.  */
#define	__WSTOPSIG(status)	__WEXITSTATUS(status)

/* Nonzero if STATUS indicates normal termination.  */
#define	__WIFEXITED(status)	(__WTERMSIG(status) == 0)

/* Nonzero if STATUS indicates termination by a signal.  */
#define __WIFSIGNALED(status) \
  (((signed char) (((status) & 0x7f) + 1) >> 1) > 0)

/* Nonzero if STATUS indicates the child is stopped.  */
#define	__WIFSTOPPED(status)	(((status) & 0xff) == 0x7f)

WIFEXITED(0xB800) is true => the process exited normally (returning from the C main function, or by calling posix exit())
WEXITSTATUS(0xB800) = 0xB8 = 139

Another information is that the Lua VM is run through a wrapper sh script (that setups the environment variables, etc)
From the sh manual (man sh) I got:

So in this case it means that the program run by the wrapper script (i.e. the Lua executable) stopped with signal 11, a.k.a SEGV or segmentation fault.

So it seems you program is having a segmentation fault. This should not happen in Lua, so there may be a bug in the Lua libraries (or at least a lack of protection when calling with bad parameters). I will not be able to provide you more information without the actual code that cause this crash. Could you attach a code sample that reproduce this issue?

In addition to this, please note that the AAF application monitor daemon is watching your app, and should detect this crash and automatically restart your application within a few seconds. Please let me know if this is not the case.