getn is deprecated

This commit is contained in:
Enno Rehling 2019-09-15 13:37:04 +02:00
parent fa3abe8c32
commit 52f08917d5
2 changed files with 5 additions and 2 deletions

View File

@ -23,7 +23,7 @@ function test_get_allies()
assert_equal(0, #allies) assert_equal(0, #allies)
f1:set_ally(f2, "give", true) f1:set_ally(f2, "give", true)
allies = f1.allies allies = f1.allies
assert_not_nil(1, table.getn(allies)) assert_not_nil(allies[f2.id])
assert_equal('table', type(allies[f2.id])) assert_equal('table', type(allies[f2.id]))
assert_equal(1, #allies[f2.id]) assert_equal(1, #allies[f2.id])
assert_equal("give", allies[f2.id][1]) assert_equal("give", allies[f2.id][1])

View File

@ -32,7 +32,10 @@
#include <lauxlib.h> #include <lauxlib.h>
#include <tolua.h> #include <tolua.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdbool.h> // for bool
#include <stdio.h> // for puts
struct allies;
int tolua_factionlist_next(lua_State * L) int tolua_factionlist_next(lua_State * L)
{ {