ActorUtil lua functions now check whether the actor has a name, which is required.

This commit is contained in:
Kyzentun Keeslala
2015-06-11 19:36:25 -06:00
parent 3bd182b523
commit 829e861192
+10
View File
@@ -642,21 +642,31 @@ namespace
lua_pushboolean( L, IsRegistered(SArg(1)) );
return 1;
}
static void name_error(Actor* p, lua_State* L)
{
if(p->GetName() == "")
{
luaL_error(L, "LoadAllCommands requires the actor to have a name.");
}
}
static int LoadAllCommands( lua_State *L )
{
Actor *p = Luna<Actor>::check( L, 1 );
name_error(p, L);
ActorUtil::LoadAllCommands( p, SArg(2) );
return 0;
}
static int LoadAllCommandsFromName( lua_State *L )
{
Actor *p = Luna<Actor>::check( L, 1 );
name_error(p, L);
ActorUtil::LoadAllCommandsFromName( *p, SArg(2), SArg(3) );
return 0;
}
static int LoadAllCommandsAndSetXY( lua_State *L )
{
Actor *p = Luna<Actor>::check( L, 1 );
name_error(p, L);
ActorUtil::LoadAllCommandsAndSetXY( p, SArg(2) );
return 0;
}