From 413ced137d1e42850281d710924bb9ff87742acf Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Sun, 28 Jul 2013 17:48:05 +0100
Subject: [PATCH] [Change] Fixed space.faction to allow to check easily for
 certain factions.

---
 src/llua.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/llua.c b/src/llua.c
index 005e22c..5686645 100644
--- a/src/llua.c
+++ b/src/llua.c
@@ -308,9 +308,9 @@ static int space_faction(lua_State* L) {
   /* Return the result in table. */
   lua_newtable(L);
   for(i = 0; i < s->nplanets; i++) {
-    lua_pushnumber(L, i+1); /* Index. */
-    lua_pushstring(L, faction_name(s->planets[i].faction)); /* Value. */
-    lua_rawset(L, -3); /* Store in table. */
+    lua_pushboolean(L, 1); /* Value. */
+    lua_setfield(L, -2, faction_name(s->planets[i].faction)); /* Key. */
+    /* Allows syntax foo = space.faction("foo"); if foo["bar"] then ... end */
   }
   return 1;
 }