Skip to content

Commit

Permalink
Fixed invalid output for good - it was just a corner case (possibly d…
Browse files Browse the repository at this point in the history
…ue to a bug in format_signature), this solution should be universal
  • Loading branch information
mrwonko authored and Oberon00 committed Jun 29, 2013
1 parent f13671c commit 9d15e02
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ void invoke_context::format_error(

if (candidate_index == 0)
{
int stacksize = lua_gettop(L);
lua_pushstring(L, "No matching overload found, candidates:\n");
int count = 0;
for (function_object const* f = overloads; f != 0; f = f->next)
Expand All @@ -116,19 +117,20 @@ void invoke_context::format_error(
f->format_signature(L, function_name);
++count;
}
lua_concat(L, count * 2 + 1);
lua_concat(L, lua_gettop(L) - stacksize);
}
else
{
// Ambiguous
int stacksize = lua_gettop(L);
lua_pushstring(L, "Ambiguous, candidates:\n");
for (int i = 0; i < candidate_index; ++i)
{
if (i != 0)
lua_pushstring(L, "\n");
candidates[i]->format_signature(L, function_name);
}
lua_concat(L, candidate_index * 2);
lua_concat(L, lua_gettop(L) - stacksize);
}
}

Expand Down

0 comments on commit 9d15e02

Please sign in to comment.