-
Notifications
You must be signed in to change notification settings - Fork 22
def a function
yanwei edited this page Apr 19, 2016
·
5 revisions
//def a function to lua
lua_tinker::def(L, "Number2Interger", &Number2Interger);
//def a std::function to lua
std::function<void(int,int)> func = [](int k,int j)
{std::cout << "test_p_int1(" << k <<"," << j << ")" << std::endl;};
lua_tinker::def(L, "test_p_int1", func); //can hold function
//def a overload_function to lua
lua_tinker::def(L, "test_overload", lua_tinker::args_type_overload_functor(
lua_tinker::make_functor_ptr((int(*)(int)) (&test_overload)),
lua_tinker::make_functor_ptr((int(*)(int, double))(&test_overload)),
lua_tinker::make_functor_ptr((int(*)(int, int, double))(&test_overload))));