fix access to console.__add_command
This commit is contained in:
parent
e7e47df7bf
commit
76be41e8f2
@ -94,6 +94,13 @@ table.sub(arr: table, start: number | nil, stop: number | nil) -> table
|
||||
|
||||
Возвращает обрезанную версию таблицы с индекса **start** до индекса **stop** включительно, при этом пары ключ-значение не сохраняются в новой таблице. При значениях **nil** начинает с **1** и заканчивает **#arr** соответственно.
|
||||
|
||||
```lua
|
||||
table.insert_unique(t: table, val: any)
|
||||
table.insert_unique(t: table, pos: number, val: any)
|
||||
```
|
||||
|
||||
Добавляет значение в таблицу, только если его там не было.
|
||||
|
||||
```lua
|
||||
table.tostring(t: table) -> string
|
||||
```
|
||||
|
||||
@ -167,12 +167,16 @@ function table.remove_value(t, x)
|
||||
end
|
||||
end
|
||||
|
||||
function table.insert_unique(t, val)
|
||||
if table.has(t, val) then
|
||||
function table.insert_unique(t, pos_or_val, val)
|
||||
if table.has(t, val or pos_or_val) then
|
||||
return
|
||||
end
|
||||
|
||||
table.insert(t, val)
|
||||
if val then
|
||||
table.insert(t, pos_or_val, val)
|
||||
else
|
||||
table.insert(t, pos_or_val)
|
||||
end
|
||||
end
|
||||
|
||||
function table.tostring(t)
|
||||
|
||||
@ -171,8 +171,11 @@ function console.log(...)
|
||||
log_element:paste(text)
|
||||
end
|
||||
|
||||
local console_add_command = console.__add_command
|
||||
console.__add_command = nil
|
||||
|
||||
function console.add_command(scheme, description, handler, is_cheat)
|
||||
console.__add_command(scheme, description, handler)
|
||||
console_add_command(scheme, description, handler)
|
||||
if not is_cheat then return end
|
||||
|
||||
local name = string.match(scheme, "^(%S+)")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user