Beispiel #1
0
static cell AMX_NATIVE_CALL format_args(AMX *amx, cell *params)
{
	int len;
	int pos = params[3];
	
	if (pos < 0)
	{
		LogError(amx, AMX_ERR_NATIVE, "Pos has to be a positive number");
		return 0;
	}

	char* string = format_arguments(amx, pos, len); // indexed from 0
	
	return set_amxstring_utf8(amx, params[1], string, len, params[2]);
}
Beispiel #2
0
AbstractString * Condition::write_to_string()
{
  Thread * const thread = current_thread();
  if (CL_fboundp(S_print_object) != NIL)
    {
      StringOutputStream * stream = new StringOutputStream(S_character);
      thread->execute(the_symbol(S_print_object)->function(),
                      make_value(this),
                      make_value(stream));
      AbstractString * s = stream->get_string();
      return s;
    }
  if (thread->symbol_value(S_print_escape) == NIL && thread->symbol_value(S_print_readably) == NIL)
    {
      if (stringp(format_control()))
        {
          if (format_arguments() != NIL)
            return format_to_string(format_control(), format_arguments());
          else
            return the_string(format_control());
        }
    }
  return unreadable_string();
}