| 682 | // call |
| 683 | template<typename RVal> |
| 684 | RVal call(lua_State* L, const char* name) |
| 685 | { |
| 686 | lua_pushcclosure(L, on_error, 0); |
| 687 | int errfunc = lua_gettop(L); |
| 688 | |
| 689 | lua_getglobal(L, name); |
| 690 | if(lua_isfunction(L,-1)) |
| 691 | { |
| 692 | if(lua_pcall(L, 0, 1, errfunc) != 0) |
| 693 | { |
| 694 | lua_pop(L, 1); |
| 695 | } |
| 696 | } |
| 697 | else |
| 698 | { |
| 699 | print_error(L, "lua_tinker::call() attempt to call global `%s' (not a function)", name); |
| 700 | } |
| 701 | |
| 702 | lua_remove(L, -2); |
| 703 | return pop<RVal>(L); |
| 704 | } |
| 705 | |
| 706 | template<typename RVal, typename T1> |
| 707 | RVal call(lua_State* L, const char* name, T1 arg) |
nothing calls this directly
no test coverage detected