Advertisement
sopyanx

tg_getkey

Mar 24th, 2019
1,280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. :local cur 0
  2. :local lkey [:len $key]
  3. :local res ""
  4. :local p
  5.  
  6. :if ([:len $block]>0) do={
  7. :set p [:find $text $block $cur]
  8. :if ([:type $p]="nil") do={
  9. :return $res
  10. }
  11. :set cur ($p+[:len $block]+2)
  12. }
  13.  
  14. :set p [:find $text $key $cur]
  15. :if ([:type $p]!="nil") do={
  16. :set cur ($p+lkey+2)
  17. :set p [:find $text "," $cur]
  18. :if ([:type $p]!="nil") do={
  19. if ([:pick $text $cur]="\"") do={
  20. :set res [:pick $text ($cur+1) ($p-1)]
  21. } else={
  22. :set res [:pick $text $cur $p]
  23. }
  24. }
  25. }
  26. :return $res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement