- setting lastorders from lua

This commit is contained in:
Enno Rehling 2009-07-08 10:39:13 +00:00
parent 1c2bbbc21e
commit 0248798655
2 changed files with 12 additions and 2 deletions

View File

@ -180,6 +180,16 @@ tolua_faction_get_lastturn(lua_State* L)
return 1;
}
static int
tolua_faction_set_lastturn(lua_State* L)
{
faction * self = (faction *)tolua_tousertype(L, 1, 0);
if (self) {
self->lastorders = (int)tolua_tonumber(L, 2, self->lastorders);
}
return 0;
}
static int
tolua_faction_renumber(lua_State* L)
{
@ -463,7 +473,7 @@ tolua_faction_open(lua_State* L)
tolua_variable(L, TOLUA_CAST "age", tolua_faction_get_age, tolua_faction_set_age);
tolua_variable(L, TOLUA_CAST "options", tolua_faction_get_options, tolua_faction_set_options);
tolua_variable(L, TOLUA_CAST "flags", tolua_faction_get_flags, NULL);
tolua_variable(L, TOLUA_CAST "lastturn", tolua_faction_get_lastturn, NULL);
tolua_variable(L, TOLUA_CAST "lastturn", tolua_faction_get_lastturn, tolua_faction_set_lastturn);
tolua_function(L, TOLUA_CAST "set_policy", tolua_faction_set_policy);
tolua_function(L, TOLUA_CAST "get_policy", tolua_faction_get_policy);

View File

@ -540,7 +540,7 @@ mytests = {
["market"] = test_market
}
fail = 0
for k, v in pairs(mytests) do
for k, v in pairs(tests) do
local status, err = pcall(v)
if not status then
fail = fail + 1