Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2005:
[Freeciv-Dev] (PR#13019) Meta-Ticket: Improved scripting
Home

[Freeciv-Dev] (PR#13019) Meta-Ticket: Improved scripting

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13019) Meta-Ticket: Improved scripting
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Mon, 9 May 2005 18:37:34 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13019 >

Add slighly better error reporting for when a callback fails.

? .tutorial.sav.swp
Index: server/scripting/script.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/scripting/script.c,v
retrieving revision 1.2
diff -u -u -r1.2 script.c
--- server/scripting/script.c   9 May 2005 21:24:48 -0000       1.2
+++ server/scripting/script.c   10 May 2005 01:36:39 -0000
@@ -136,8 +136,9 @@
     }
   }
 
-  /* Call the function with nargs arguments, return 2 results */
-  if (lua_pcall(state, nargs, 2, 0) != 0) {
+  /* Call the function with nargs arguments, return 1 results */
+  if (lua_pcall(state, nargs, 1, 0) != 0) {
+    freelog(LOG_ERROR, "Error in script function \"%s\"", callback_name);
     return FALSE;
   }
 
@@ -146,7 +147,6 @@
   if (nres == 1) {
     if (lua_isboolean(state, -1)) {
       res = lua_toboolean(state, -1);
-      lua_pop(state, 1);
 
       /* Shall we stop the emission of this signal? */
       if (res) {

[Prev in Thread] Current Thread [Next in Thread]