mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 13:03:27 +02:00
lua hotkeys system
This commit is contained in:
@@ -1,18 +1,23 @@
|
||||
function string:split(sep)
|
||||
local t = { }
|
||||
local function helper(word)
|
||||
table.insert(t, word)
|
||||
return ""
|
||||
end
|
||||
if not self:gsub("%w+", helper):find("%S") then
|
||||
return t
|
||||
function string.split(s, delim)
|
||||
local start = 1
|
||||
local results = {}
|
||||
while true do
|
||||
local pos = string.find(s, delim, start, true)
|
||||
if not pos then
|
||||
break
|
||||
end
|
||||
table.insert(results, string.sub(s, start, pos-1))
|
||||
start = pos + string.len(delim)
|
||||
end
|
||||
table.insert(results, string.sub(s, start))
|
||||
table.removevalue(results, '')
|
||||
return results
|
||||
end
|
||||
|
||||
function string:starts(start)
|
||||
return self:sub(1, #start) == start
|
||||
function string.starts(s, start)
|
||||
return string.sub(s, 1, #start) == start
|
||||
end
|
||||
|
||||
function string:trim()
|
||||
return self:match('^%s*(.*%S)') or ''
|
||||
function string.trim(s)
|
||||
return string.match(s, '^%s*(.*%S)') or ''
|
||||
end
|
||||
|
Reference in New Issue
Block a user