Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit a8d8669

Browse files
committed
Add getwptid()
1 parent 3ce9465 commit a8d8669

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/General.lua

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,4 +534,25 @@ function waitcondition(f, time, fArgs)
534534
end
535535

536536
return false
537+
end
538+
539+
--[[
540+
* Given a waypoint's label, gives its ID. Only works on the current section. If
541+
* no waypoint with that label is found, nothing is returned.
542+
*
543+
* @since 1.2.0
544+
*
545+
* @param {string} label - The waypoint's label
546+
*
547+
* @returns {number} - The waypoint's ID
548+
--]]
549+
function getwptid(label)
550+
local id = 0
551+
foreach settingsentry s 'Cavebot/Waypoints' do
552+
if get(s, 'Label') == label then
553+
return id
554+
end
555+
556+
id = id + 1
557+
end
537558
end

0 commit comments

Comments
 (0)