[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: NOOB Question : Return values
- From: paul.morriss@...
- Date: Mon, 14 Feb 2005 00:17:35 -0000 (GMT)
Hi
As you have guessed from the subject I have just started to use Lua, I
am trying to work out how to stop Lua upon an error, in a custom
registered function I tried lua_error but that just displayed the last
item in the stack.
<code snippet>
int Add_Object_To_Array( lua_State* luaVM )
{
printf( "Adding object '%s' to array\n", lua_tostring(luaVM, -1) );
// Force an error to see if this works
lua_pushstring( luaVM, "Add_Object_To_Array :: Failed" );
lua_error( luaVM );
return 0;
}
</code snippet>
Many thanks
Paul