From 81ccac343fe61d1213a798152a337bb23c45965e Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Fri, 21 Feb 2014 21:34:01 -0800 Subject: [PATCH] Deprecate Call syntax. --- README.md | 8 -------- include/selene/Selector.h | 10 ---------- test/obj_tests.h | 6 +++--- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 4dba582..d5cce26 100644 --- a/README.md +++ b/README.md @@ -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(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 diff --git a/include/selene/Selector.h b/include/selene/Selector.h index 3ef5279..3f86f6b 100644 --- a/include/selene/Selector.h +++ b/include/selene/Selector.h @@ -101,16 +101,6 @@ class Selector { return *this; } - template - typename detail::_pop_n_impl::type - Call(Args&&... args) const { - _traverse(); - _get(); - detail::_push_n(_state, std::forward(args)...); - lua_call(_state, sizeof...(Args), sizeof...(Ret)); - return detail::_pop_n_reset(_state); - } - template void operator=(T t) const { _traverse(); diff --git a/test/obj_tests.h b/test/obj_tests.h index 61e45be..eadee54 100644 --- a/test/obj_tests.h +++ b/test/obj_tests.h @@ -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; } @@ -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; } @@ -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; }