Extensions

- Created scripts/extensions/README to describe samples.
- Created sample extension scripts of each type.
This commit is contained in:
Paul Beckingham 2011-04-18 00:51:34 -04:00
parent bac4610580
commit 60a5d271f4
10 changed files with 335 additions and 55 deletions

View file

@ -53,7 +53,6 @@
#include <API.h>
extern Context context;
Task* the_task = NULL;
#ifdef HAVE_LIBLUA
@ -122,6 +121,7 @@ static int api_task_set (lua_State* L)
catch (...)
{
// TODO Error!
lua_pushstring (L, "");
}
}
@ -223,16 +223,10 @@ bool API::callTaskHook (
// Prepare args.
lua_pushnumber (L, current.id);
// Expose the task.
the_task = &current;
// Make call.
if (lua_pcall (L, 1, 2, 0) != 0)
throw std::string ("Error calling '") + function + "' - " + lua_tostring (L, -1) + ".";
// Hide the task.
the_task = NULL;
// Call successful - get return values.
if (!lua_isnumber (L, -2))
throw std::string ("Error: '") + function + "' did not return a success indicator.";