Skip to content

Commit

Permalink
Fix LINT broken by dfa0c15
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzhul committed May 21, 2017
1 parent dfa0c15 commit de840fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/script/lua_api/l_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,39 +269,39 @@ int ModApiClient::l_get_item_def(lua_State *L)

IItemDefManager *idef = gdef->idef();
assert(idef);

if (!lua_isstring(L, 1))
return 0;

const std::string &name(lua_tostring(L, 1));
if (!idef->isKnown(name))
return 0;
const ItemDefinition &def = idef->get(name);

push_item_definition_full(L, def);

return 1;
push_item_definition_full(L, def);

return 1;
}

// get_node_def(nodename)
int ModApiClient::l_get_node_def(lua_State *L)
{
IGameDef *gdef = getGameDef(L);
assert(gdef);

INodeDefManager *ndef = gdef->ndef();
assert(ndef);

if (!lua_isstring(L, 1))
return 0;

const std::string &name = lua_tostring(L, 1);
const ContentFeatures &cf = ndef->get(ndef->getId(name));
if (cf.name != name) // Unknown node. | name = <whatever>, cf.name = ignore
return 0;

push_content_features(L, cf);

return 1;
}

Expand Down
4 changes: 2 additions & 2 deletions src/script/lua_api/l_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ class ModApiClient : public ModApiBase

// get_server_info()
static int l_get_server_info(lua_State *L);

// get_item_def(itemstring)
static int l_get_item_def(lua_State *L);

// get_node_def(nodename)
static int l_get_node_def(lua_State *L);

Expand Down

0 comments on commit de840fe

Please sign in to comment.