Exemplo n.º 1
0
    static int entry_point(lua_State* L)
    {
        function_object_impl const* impl =
            *static_cast<function_object_impl const**>(
                lua_touserdata(L, lua_upvalueindex(1)));

        int results = 0;
        bool error = false;

# ifndef LUABIND_NO_EXCEPTIONS
        try
#endif
            // Scope neeeded to destroy invoke_context before calling lua_error()
        {
            invoke_context ctx;
            results = invoke(
                          L, *impl, ctx, impl->f, Signature(), impl->policies);
            if (!ctx)
            {
                ctx.format_error(L, impl);
                error = true;
            }
        }
#ifndef LUABIND_NO_EXCEPTIONS
        catch (...)
        {
            error = true;
            handle_exception_aux(L);
        }
#endif

        if (error)
            lua_error(L);
        return results;
    }
Exemplo n.º 2
0
            static bool invoke_defer(lua_State* L, function_object_impl* impl, invoke_context& ctx, int& results)
			{
				bool exception_caught = false;

				try {
#ifndef LUABIND_NO_INTERNAL_TAG_ARGUMENTS
					results = invoke(L, *impl, ctx, impl->f, Signature(), InjectorList());
#else
					results = invoke<InjectorList, Signature>(L, *impl, ctx, impl->f);
#endif
				}
				catch(...) {
					exception_caught = true;
					handle_exception_aux(L);
				}

				return exception_caught;
			}
Exemplo n.º 3
0
      static int entry_point(lua_State* L)
      {
          function_object_impl const* impl =
              *(function_object_impl const**)lua_touserdata(L, lua_upvalueindex(1));

          invoke_context ctx;

          int results = 0;

# ifndef LUABIND_NO_EXCEPTIONS
          bool exception_caught = false;

          try
          {
              results = invoke(
                  L, *impl, ctx, impl->f, Signature(), impl->policies);
          }
          catch (...)
          {
              exception_caught = true;
              handle_exception_aux(L);
          }

          if (exception_caught)
              lua_error(L);
# else
          results = invoke(L, *impl, ctx, impl->f, Signature(), impl->policies);
# endif

          if (!ctx)
          {
              ctx.format_error(L, impl);
              lua_error(L);
          }

          return results;
      }