Skip to content

2.2 [260731a]

Latest

Choose a tag to compare

@ejetaxeblevich ejetaxeblevich released this 31 Jul 18:59
  • Добавлены новые методы и функции:
[F] int string.commas( string )
/* Возвращает количество запятых из строки */

[F] table table.clear( table )
/* Очищает существующую таблицу, чтобы не создавать новую.

   Проходит по числовым индексам таблицы
   в таблице не должно быть "дырок":
       local t = {[1] = 1, [3] = 3} --> внутри таблицы t нет второго индекса (он уже nil)
   = на этой дырке цикл остановится! */

[F] table table.clear2( table )
/* Очищает существующую таблицу, чтобы не создавать новую.

   Проходит по всем индексам и ключам таблицы,
   очищая таблицу целиком вне зависимости от наличия "дырок",
   жертвуя скоростью по сравнению с [table.clear()] */

Использование table.clear2:

local t = {
    a = 3, 
    [67] = "text",
    ["mega_prikol"] = function() return "huy" end
}
table.clear2(t)
--> t = {}
  • Изменен ReadMe.

Click here for view text of the update is in English
  • Added new methods and functions:
[F] int string.commas( string )
/* Returns the number of commas from a string */

[F] table table.clear( table )
/* Clears an existing table so as not to create a new one.

   Passes through the numeric indexes of the table
   there should be no "holes" in the table:
      local t = {[1] = 1, [3] = 3} --> there is no second index inside table t (it is already nil)
   = the cycle stops at this hole! */

[F] table table.clear2( table )
/* Clears an existing table so as not to create a new one.

   Passes through all indexes and keys of the table,
   clearing the entire table regardless of the presence of "holes",
   sacrificing speed compared to [table.clear()] */

Example table.clear2 usage:

local t = {
    a = 3, 
    [67] = "text",
    ["mega_prikol"] = function() return "huy" end
}
table.clear2(t)
--> t = {}
  • Edited ReadMe.