Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2005:
[Freeciv-Dev] (PR#13729) [PATCH] invalid 'self' in accessing variable 'o
Home

[Freeciv-Dev] (PR#13729) [PATCH] invalid 'self' in accessing variable 'o

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13729) [PATCH] invalid 'self' in accessing variable 'owner'
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Sun, 21 Aug 2005 02:32:22 -0700
Reply-to: bugs@xxxxxxxxxxx

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

When running civserver, this message shows up on executable launch:
"invalid 'self' in accessing variable 'owner'"

Basically the problem was that in the inline Lua code at api.pkg, some
code used class method names which clashed with class attributes, and
the code tried to access class attributes which do not exist.

When the classes declarations at api.pkg were changed, the inline code
in the same file should have changed as well.

This patch should fix it.

Reported by Per on IRC.

Index: server/scripting/api.pkg
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/scripting/api.pkg,v
retrieving revision 1.14
diff -u -u -r1.14 api.pkg
--- server/scripting/api.pkg    1 Aug 2005 22:38:27 -0000       1.14
+++ server/scripting/api.pkg    21 Aug 2005 09:25:02 -0000
@@ -139,29 +139,11 @@
   return methods_player_num_units(self)
 end
 
--- City methods.
-function City:owner()
-  return find.player(self.owner_id)
-end
-
 -- Unit methods.
-function Unit:type()
-  return find.unit_type(self.type_id)
-end
-
-function Unit:owner()
-  return find.player(self.owner_id)
-end
-
 function Unit:homecity()
   return find.city(self:owner(), self.homecity_id)
 end
 
--- Tile methods.
-function Tile:terrain()
-  return find.terrain(self.terrain_id)
-end
-
 -- Building_Type methods.
 function Building_Type:build_shield_cost()
   return self.build_cost

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13729) [PATCH] invalid 'self' in accessing variable 'owner', Vasco Alexandre da Silva Costa <=