Beispiel #1
0
Ink_Object *InkNative_Object_Index(Ink_InterpreteEngine *engine, Ink_ContextChain *context, Ink_ArgcType argc, Ink_Object **argv, Ink_Object *this_p)
{
	Ink_Object *base = context->searchSlot(engine, "base");

	if (!checkArgument(engine, argc, argv, 1, INK_STRING)) {
		return NULL_OBJ;
	}
	
	if (!base->getSlotMapping(engine, as<Ink_String>(argv[0])->getValue().c_str())) {
		string *tmp = new string(as<Ink_String>(argv[0])->getValue());
		return getSlotWithProto(engine, context, base, tmp->c_str(), tmp);
	}

	return getSlotWithProto(engine, context, base, as<Ink_String>(argv[0])->getValue().c_str());
}
Beispiel #2
0
Ink_Object *InkNative_Object_Index(Ink_InterpreteEngine *engine, Ink_ContextChain *context, Ink_Object *base, Ink_ArgcType argc, Ink_Object **argv, Ink_Object *this_p)
{
	string tmp;

	if (!checkArgument(engine, argc, argv, 1, INK_STRING)) {
		return NULL_OBJ;
	}

	tmp = as<Ink_String>(argv[0])->getValue();

	return getSlotWithProto(engine, context, base, tmp.c_str());
}