Advertisement
Guest User

Untitled

a guest
Apr 4th, 2022
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.43 KB | None | 0 0
  1. function _init()
  2.  cls()
  3.  
  4.  local input="line(16,16,64,32,7)"
  5.  
  6.  local p1=index_of(input,"(")
  7.  local p2=index_of(input,")")
  8.  
  9.  local cmd=sub(input,1,p1-1)
  10.  local args=sub(input,p1+1,p2-1)
  11.  
  12.  if cmd=="line" then
  13.   line(unpack(split(args)))
  14.  end
  15.  
  16. end
  17.  
  18.  
  19. -- returns first occurence of
  20. -- character c, or nil
  21. function index_of(str,c)
  22.  str=""..str
  23.  for i=1,#str do
  24.   if sub(str,i,i)==c then
  25.    return i
  26.   end
  27.  end
  28. end
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement