| 489 | } |
| 490 | |
| 491 | void LuaEnvironment::call_global(const char *func, ArgType::Enum *arg_types, Arg *args, int narg, int nres) |
| 492 | { |
| 493 | int status; |
| 494 | LuaStack stack(L, +nres); |
| 495 | CE_ENSURE(NULL != func); |
| 496 | |
| 497 | lua_getglobal(L, func); |
| 498 | |
| 499 | stack.push_args(arg_types, args, narg); |
| 500 | |
| 501 | status = call(narg, nres); |
| 502 | if (status != LUA_OK) { |
| 503 | report(L, status); |
| 504 | device()->pause(); |
| 505 | } |
| 506 | |
| 507 | CE_ASSERT(lua_gettop(L) == 0, "Stack not clean"); |
| 508 | } |
| 509 | |
| 510 | LuaStack LuaEnvironment::get_global(const char *global) |
| 511 | { |