Skip to content

Commit

Permalink
Deprecate Call syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyong committed Feb 22, 2014
1 parent acc4748 commit 81ccac3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,6 @@ result = state["mytable"]["foo"]();
assert(result == 4);
```
Generally, the `operator()` implemenation *does not* actually execute
the function call until a typecast occurs. In otherwords, the actual
type of something like `state["add"](5, 2)` is still a
`sel::Selector`. However, if the `Selector` is then typecast, as in a
statement like `int answer = state["add"](5, 2)`, then the invocation
of the function will occur. This is short hand for
`int answer = state["add"].Call<int>(5, 2)`.
Note that multi-value returns must have `sel::tie`
on the LHS and not `std::tie`. This will create a `sel::Tuple` as
opposed to an `std::tuple` which has the `operator=` implemented for
Expand Down
10 changes: 0 additions & 10 deletions include/selene/Selector.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,6 @@ class Selector {
return *this;
}

template <typename... Ret, typename... Args>
typename detail::_pop_n_impl<sizeof...(Ret), Ret...>::type
Call(Args&&... args) const {
_traverse();
_get();
detail::_push_n(_state, std::forward<Args>(args)...);
lua_call(_state, sizeof...(Args), sizeof...(Ret));
return detail::_pop_n_reset<Ret...>(_state);
}

template <typename T>
void operator=(T t) const {
_traverse();
Expand Down
6 changes: 3 additions & 3 deletions test/obj_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bool test_register_obj(sel::State &state) {
bool test_register_obj_member_variable(sel::State &state) {
Foo foo_instance(1);
state["foo_instance"].SetObj(foo_instance, "x", &Foo::x);
state["foo_instance"]["set_x"].Call(3);
state["foo_instance"]["set_x"](3);
const int answer = state["foo_instance"]["x"]();
return answer == 3;
}
Expand All @@ -46,7 +46,7 @@ bool test_register_obj_to_table(sel::State &state) {
bool test_mutate_instance(sel::State &state) {
Foo foo_instance(1);
state["foo_instance"].SetObj(foo_instance, "set_x", &Foo::SetX);
state["foo_instance"]["set_x"].Call(4);
state["foo_instance"]["set_x"](4);
return foo_instance.x == 4;
}

Expand All @@ -55,7 +55,7 @@ bool test_multiple_methods(sel::State &state) {
state["foo_instance"].SetObj(foo_instance,
"double_add", &Foo::DoubleAdd,
"set_x", &Foo::SetX);
state["foo_instance"]["set_x"].Call(4);
state["foo_instance"]["set_x"](4);
const int answer = state["foo_instance"]["double_add"](3);
return answer == 14;
}

0 comments on commit 81ccac3

Please sign in to comment.