Advertisement
Guest User

[Computer Craft] Mouse File Browser 0.1a by BigSHinyToys

a guest
Oct 28th, 2012
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.32 KB | None | 0 0
  1. --[[
  2.         file selection and dilog box API / lib / other
  3.         by BigSHinyToys
  4.         note: send link to nightin9ale on CC forums
  5. ]]--
  6.  
  7. local tArgs = {...}
  8. local ver = "0.1a"
  9.  
  10. local bugTest = false
  11.  
  12. if tArgs[1] and tArgs[1] == "-d" then
  13.     bugTest = true
  14. end
  15.  
  16. local function clear()
  17.     term.setBackgroundColor(colors.black)
  18.     term.setTextColor(colors.white)
  19.     term.clear()
  20.     term.setCursorBlink(false)
  21.     term.setCursorPos(1,1)
  22. end
  23.  
  24. local function dialogBox(title,message,options)
  25.     term.setCursorBlink(false)
  26.     local selected = 1
  27.     local boxW,boxH = 26,3
  28.     local termX,termY = term.getSize()
  29.     local ofsX,ofsY = (termX/2) - (boxW/2) , (termY/2) - (boxH/2) -- offset from top left
  30.    
  31.     local space = 0
  32.     local range = {}
  33.     for i = 1,#options do
  34.         range[i] = {s = space,f = space + string.len(options[i])}
  35.         space = space + string.len(options[i])+3
  36.     end
  37.     local ofC = (boxW/2) - (space/2)
  38.    
  39.     local function drawBox()
  40.         if term.isColor() then
  41.             term.setTextColor(colors.black)
  42.             term.setCursorPos(ofsX,ofsY)
  43.             term.setBackgroundColor(colors.blue)
  44.             term.write(" "..title..string.rep(" ",boxW-#title-5).."_[]")
  45.             term.setBackgroundColor(colors.red)
  46.             term.setTextColor(colors.white)
  47.             term.write("X")
  48.             term.setCursorPos(ofsX,ofsY+1)
  49.             term.setBackgroundColor(colors.white)
  50.             term.setTextColor(colors.black)
  51.             term.write(" "..message..string.rep(" ",boxW-#message-1))
  52.             term.setCursorPos(ofsX,ofsY+2)
  53.             term.write(string.rep(" ",boxW))
  54.             term.setCursorPos(ofsX,ofsY+3)
  55.            
  56.             term.write(string.rep(" ",boxW))
  57.             for i = 1,#options do
  58.                 if i == selected then
  59.                     term.setBackgroundColor(colors.lightGray)
  60.                     term.setCursorPos(range[i].s + ofC + ofsX - 1,ofsY + 3)
  61.                     term.write("["..options[i].."]")
  62.                     term.setBackgroundColor(colors.white)
  63.                     term.write(" ")
  64.                 else
  65.                     term.setCursorPos(range[i].s + ofC + ofsX - 1,ofsY + 3)
  66.                     term.write(" "..options[i].." ")
  67.                 end
  68.             end
  69.             term.setCursorPos(ofsX + ofC + space,ofsY + 3)
  70.             term.write(string.rep(" ",boxW - (ofC + space)))
  71.             term.setBackgroundColor(colors.black)
  72.             term.setTextColor(colors.white)
  73.         else
  74.            
  75.         end
  76.     end
  77.     while true do
  78.         drawBox()
  79.         event = {os.pullEvent()}
  80.         if event[1] == "key" then
  81.             if event[2] == 203 then -- left
  82.                 selected = selected - 1
  83.                 if selected < 1 then
  84.                     selected = #options
  85.                 end
  86.             elseif event[2] == 205 then -- right
  87.                 selected = selected + 1
  88.                 if selected > #options then
  89.                     selected = 1
  90.                 end
  91.             elseif event[2] == 28 then -- enter
  92.                 return selected , options[selected]
  93.             end
  94.         elseif event[1] == "mouse_click" then
  95.             term.setCursorPos(1,1)
  96.             term.clearLine()
  97.            
  98.             if bugTest then term.write("M "..event[2].." X "..event[3].." Y "..event[4]) end
  99.            
  100.             if event[2] == 1 then
  101.                 if event[4] == ofsY + 3 then
  102.                     for i = 1,#options do
  103.                         if event[3] >= range[i].s + ofC + ofsX - 1 and event[3] <= range[i].f + ofC + ofsX then
  104.                             return i , options[i]
  105.                         end
  106.                     end
  107.                 end
  108.             end
  109.         end
  110.     end
  111. end
  112.  
  113. -- modified read made to play nice with coroutines
  114.  
  115. local sLine = ""
  116.  
  117. local function readMOD( _sReplaceChar, _tHistory,_wdth)
  118.     term.setCursorBlink( true )
  119.  
  120.     local nHistoryPos = nil
  121.     local nPos = 0
  122.     if _sReplaceChar then
  123.         _sReplaceChar = string.sub( _sReplaceChar, 1, 1 )
  124.     end
  125.    
  126.     local w, h = term.getSize()
  127.     if _wdth and type(_wdth) == "number" then
  128.         w = _wdth
  129.     end
  130.     local sx, sy = term.getCursorPos() 
  131.    
  132.     local function redraw( _sCustomReplaceChar )
  133.         local nScroll = 0
  134.         if sx + nPos >= w then
  135.             nScroll = (sx + nPos) - w
  136.         end
  137.            
  138.         term.setCursorPos( sx, sy )
  139.         local sReplace = _sCustomReplaceChar or _sReplaceChar
  140.         if sReplace then
  141.             term.write( string.rep(sReplace, string.len(sLine) - nScroll) )
  142.         else
  143.             term.write( string.sub( sLine, nScroll + 1 ) )
  144.         end
  145.         term.setCursorPos( sx + nPos - nScroll, sy )
  146.     end
  147.    
  148.     while true do
  149.         local sEvent, param = os.pullEvent()
  150.         if sEvent == "char" then
  151.             sLine = string.sub( sLine, 1, nPos ) .. param .. string.sub( sLine, nPos + 1 )
  152.             nPos = nPos + 1
  153.             redraw()
  154.            
  155.         elseif sEvent == "key" then
  156.             if param == keys.enter then
  157.                 -- Enter
  158.                 -- break
  159.                
  160.             elseif param == keys.left then
  161.                 -- Left
  162.                 if nPos > 0 then
  163.                     nPos = nPos - 1
  164.                     redraw()
  165.                 end
  166.                
  167.             elseif param == keys.right then
  168.                 -- Right               
  169.                 if nPos < string.len(sLine) then
  170.                     nPos = nPos + 1
  171.                     redraw()
  172.                 end
  173.            
  174.             elseif param == keys.up or param == keys.down then
  175.                 -- Up or down
  176.                 if _tHistory then
  177.                     redraw(" ");
  178.                     if param == keys.up then
  179.                         -- Up
  180.                         if nHistoryPos == nil then
  181.                             if #_tHistory > 0 then
  182.                                 nHistoryPos = #_tHistory
  183.                             end
  184.                         elseif nHistoryPos > 1 then
  185.                             nHistoryPos = nHistoryPos - 1
  186.                         end
  187.                     else
  188.                         -- Down
  189.                         if nHistoryPos == #_tHistory then
  190.                             nHistoryPos = nil
  191.                         elseif nHistoryPos ~= nil then
  192.                             nHistoryPos = nHistoryPos + 1
  193.                         end                    
  194.                     end
  195.                    
  196.                     if nHistoryPos then
  197.                         sLine = _tHistory[nHistoryPos]
  198.                         nPos = string.len( sLine )
  199.                     else
  200.                         sLine = ""
  201.                         nPos = 0
  202.                     end
  203.                     redraw()
  204.                 end
  205.             elseif param == keys.backspace then
  206.                 -- Backspace
  207.                 if nPos > 0 then
  208.                     redraw(" ");
  209.                     sLine = string.sub( sLine, 1, nPos - 1 ) .. string.sub( sLine, nPos + 1 )
  210.                     nPos = nPos - 1                
  211.                     redraw()
  212.                 end
  213.             elseif param == keys.home then
  214.                 -- Home
  215.                 nPos = 0
  216.                 redraw()       
  217.             elseif param == keys.delete then
  218.                 if nPos < string.len(sLine) then
  219.                     redraw(" ");
  220.                     sLine = string.sub( sLine, 1, nPos ) .. string.sub( sLine, nPos + 2 )              
  221.                     redraw()
  222.                 end
  223.             elseif param == keys["end"] then
  224.                 -- End
  225.                 nPos = string.len(sLine)
  226.                 redraw()
  227.             end
  228.         elseif sEvent == "redraw" then
  229.             redraw()
  230.         end
  231.     end
  232.    
  233.     term.setCursorBlink( false )
  234.     -- term.setCursorPos( w + 1, sy )
  235.     -- print()
  236.    
  237.     return sLine
  238. end
  239.  
  240. -- end modified read
  241.  
  242. local function printC(posX,posY,textCol,backCol,text)
  243.     term.setCursorPos(posX,posY)
  244.     term.setTextColor(textCol)
  245.     term.setBackgroundColor(backCol)
  246.     term.write(text)
  247. end
  248.  
  249. local function rClickMenu(title,tList,posX,posY)
  250.  
  251.     term.setCursorBlink(false)
  252.     local BoxTitle = title
  253.     local choices = tList
  254.     local termX,termY = term.getSize()
  255.     local offX,offY
  256.    
  257.     local width = #BoxTitle + 2
  258.     local hight = #choices + 1
  259.    
  260.     for i = 1,#choices do
  261.         if width < #choices[i] + 2 then
  262.             width = #choices[i] + 2
  263.         end
  264.     end
  265.    
  266.     offX,offY = math.ceil((termX/2) - (width/2)),math.ceil((termY/2) - (hight/2))
  267.    
  268.     if posX and posY then -- offX,offY = posX,posY
  269.         if posX >= termX - width - 1 then
  270.             offX = termX - width - 1
  271.         else
  272.             offX = posX
  273.         end
  274.         if posY >= termY - hight then
  275.             offY = termY - hight
  276.         else
  277.             offY = posY
  278.         end
  279.     end
  280.    
  281.     local function reDrawer()
  282.         printC(offX,offY,colors.black,colors.blue," "..BoxTitle..string.rep(" ",width - #BoxTitle - 1))
  283.         for i = 1,#choices do
  284.             printC(offX,offY + i,colors.black,colors.white," "..choices[i]..string.rep(" ",width - #choices[i] - 1))
  285.         end
  286.     end
  287.    
  288.     while true do
  289.         reDrawer()
  290.         local event = {os.pullEvent()}
  291.         if event[1] == "mouse_click" then
  292.             if event[2] == 1 then -- event[3] = x event[4] = y
  293.                 if event[4] > offY and event[4] < hight + offY and event[3] >= offX and event[3] < width + offX then
  294.                     return choices[event[4] - offY]
  295.                 else
  296.                     return
  297.                 end
  298.             elseif event[2] == 2 then
  299.                 return
  300.             end
  301.         end
  302.     end
  303.    
  304. end
  305.  
  306. local function fileSelect(mode) -- save_file open_file browse < not yet implemented
  307.    
  308.     local title = "File Browser "..ver
  309.     local bRun = true
  310.    
  311.     local termX,termY = term.getSize()
  312.     local offsetX,offsetY = 1,1
  313.     local hight,width = math.ceil(termY-2),math.ceil(termX-2)
  314.    
  315.     local boxOffX,boxOffY = offsetX,offsetY + 2
  316.     local boxH,boxW = hight - 3 ,width - 2
  317.    
  318.     local barX,barY = offsetX + 1,offsetY + 2
  319.     local barH,barW = 1,width - 1
  320.    
  321.     local tbarX,tbarY = offsetX + 1,offsetY + 1
  322.     local tbarH,tbarW = 1,width - 1
  323.    
  324.     local exitX,exitY = offsetX + width - 1 ,offsetY + 1
  325.    
  326.     local parth = {}
  327.     local list
  328.    
  329.     local fSlash = [[\]]
  330.     local listOff = 0
  331.    
  332.     local function stringParth()
  333.         local temp = fSlash
  334.         for i = 1,#parth do
  335.             if i == #parth then
  336.                 temp = temp..parth[i]
  337.             else
  338.                 temp = temp..parth[i]..fSlash
  339.             end
  340.         end
  341.         return temp
  342.     end
  343.    
  344.     local sParth = stringParth()
  345.     local files = {}
  346.     local folders = {}
  347.     local disks = {}
  348.  
  349.     local function NewList()
  350.         listOff = 0
  351.         sParth = stringParth()
  352.         files = {}
  353.         folders = {}
  354.         disks = {}
  355.         test,list = pcall(fs.list,sParth)
  356.         -- print(" + "..tostring(test).." "..tostring(list))
  357.         for i = 1,#list do
  358.             if fs.isDir(sParth..fSlash..list[i]) then
  359.                 table.insert(folders,list[i])
  360.             else
  361.                 table.insert(files,list[i])
  362.             end
  363.         end
  364.         if #parth == 0 then
  365.             for i,v in pairs(rs.getSides()) do
  366.                 if disk.isPresent(v) and disk.hasData(v) then
  367.                     disks[disk.getMountPath(v)] = v
  368.                 end
  369.             end
  370.         end
  371.         table.sort(disks)
  372.         table.sort(folders)
  373.         table.sort(files)
  374.     end
  375.    
  376.     NewList()
  377.    
  378.     local function size(test)
  379.         if #test > boxW - 3 then
  380.             return string.sub(test,1,boxW-3)
  381.         end
  382.         return test
  383.     end
  384.    
  385.     local tRead = coroutine.create(function()
  386.         term.setCursorPos(boxOffX + 2,boxOffY + boxH + 1)
  387.         readMOD(nil,nil,boxOffX + boxW)
  388.     end)
  389.    
  390.     local function resume(...)
  391.         term.setTextColor(colors.black)
  392.         term.setBackgroundColor(colors.white)
  393.         term.setCursorPos(boxOffX + 1,boxOffY + boxH + 1)
  394.         term.write(string.rep(" ",boxW+1))
  395.         coroutine.resume(tRead,...)
  396.         term.setTextColor(colors.white)
  397.         term.setBackgroundColor(colors.black)
  398.     end
  399.    
  400.    
  401.     while bRun do
  402.        
  403.         -- draw top title bar
  404.         term.setCursorPos(tbarX,tbarY)
  405.         term.setTextColor(colors.black)
  406.         term.setBackgroundColor(colors.blue)
  407.         local b = tbarW - #title -2
  408.         if b < 0 then
  409.             b = 0
  410.         end
  411.         term.write(string.sub(" "..title,1,tbarW)..string.rep(" ",b))
  412.         term.setTextColor(colors.white)
  413.         term.setBackgroundColor(colors.red)
  414.         term.write("X")
  415.        
  416.         -- draw location bar
  417.        
  418.         term.setCursorPos(barX,barY)
  419.         term.setTextColor(colors.black)
  420.         term.setBackgroundColor(colors.lightGray)
  421.         local a = barW - #sParth - 1
  422.         if a < 0 then
  423.             a = 0
  424.         end
  425.         term.write(string.sub(" "..sParth,1,barW)..string.rep(" ",a))
  426.        
  427.         -- draw scroll bar
  428.        
  429.         if #folders + #files > boxH then
  430.             term.setBackgroundColor(colors.lightGray)
  431.             for i = 1,boxH do
  432.                 term.setCursorPos(boxOffX+boxW+1,i + boxOffY)
  433.                 local scroll = math.floor( boxH* (listOff/(#folders + #files-boxH+2)) )+1
  434.                 if i == scroll then
  435.                     term.setBackgroundColor(colors.gray)
  436.                     term.write(" ")
  437.                     term.setBackgroundColor(colors.lightGray)
  438.                 else
  439.                     term.write(" ")
  440.                 end
  441.             end
  442.         else
  443.             term.setBackgroundColor(colors.gray)
  444.             for i = 1,boxH do
  445.                 term.setCursorPos(boxOffX+boxW+1,i + boxOffY)
  446.                 term.write(" ")
  447.             end
  448.         end
  449.        
  450.         -- draw main section
  451.        
  452.         term.setTextColor(colors.black)
  453.         term.setBackgroundColor(colors.cyan)
  454.         for i = 1,boxH do
  455.             term.setCursorPos(1+boxOffX,i+boxOffY)
  456.             if folders[i+listOff] then
  457.                 if disks[folders[i+listOff]] then
  458.                     term.setTextColor(colors.orange)
  459.                     term.setBackgroundColor(colors.blue)
  460.                     term.write("D!")
  461.                 else
  462.                     term.setTextColor(colors.blue)
  463.                     term.setBackgroundColor(colors.lightBlue)
  464.                     term.write("[]")
  465.                 end
  466.                 term.setTextColor(colors.black)
  467.                 term.setBackgroundColor(colors.cyan)
  468.                 local repTimes = boxW - #folders[i+listOff] - 3
  469.                 if repTimes < 0 then
  470.                     repTimes = 0
  471.                 end
  472.                 term.write(" "..size(folders[i+listOff])..string.rep(" ",repTimes))
  473.             elseif files[i-#folders+listOff] then
  474.                 local repTimes = boxW - #files[i-#folders+listOff] - 3
  475.                 if repTimes < 0 then
  476.                     repTimes = 0
  477.                 end
  478.                 term.write("   "..size(files[i-#folders+listOff])..string.rep(" ",repTimes))
  479.             else
  480.                 term.write(string.rep(" ",boxW))
  481.             end
  482.         end
  483.         term.setTextColor(colors.white)
  484.         term.setBackgroundColor(colors.black)
  485.        
  486.         if bugTest then
  487.             term.setCursorPos(1,1)
  488.             term.write(listOff.." "..boxOffY.." "..boxH)
  489.         end
  490.        
  491.         resume("redraw")
  492.        
  493.         -- react to events
  494.        
  495.         local event = {os.pullEvent()}
  496.        
  497.         if event[1] == "mouse_click" then
  498.             if event[2] == 1 then -- left mouse
  499.                 local temp = nil
  500.                 if event[4] > boxOffY and event[4] <= boxH + boxOffY then
  501.                     temp = folders[event[4]+listOff-boxOffY] or files[event[4]-#folders+listOff-boxOffY]
  502.                 end
  503.                 if temp and event[3] > boxOffX and event[3] <= #temp + 3 + boxOffX and event[3] < boxOffX + boxW then
  504.                     if fs.isDir(stringParth()..fSlash..temp) then
  505.                         table.insert(parth,temp)
  506.                         NewList()
  507.                     else
  508.                         if fs.exists(stringParth()..fSlash..temp) then
  509.                             if dialogBox("Run file ?",temp,{"yes","no"}) == 1 then
  510.                                 clear()
  511.                                 local test,info = shell.run(stringParth()..fSlash..temp)
  512.                                 term.setCursorBlink(false)
  513.                                 if not test then
  514.                                     dialogBox("ERROR",tostring(info),{"ok"})
  515.                                 end
  516.                             end
  517.                         clear()
  518.                         end
  519.                     end
  520.                 elseif event[3] == boxOffX+boxW+1 and event[4] > boxOffY and event[4] <= boxOffY+boxH then
  521.                     if #folders + #files > boxH then
  522.                         if event[4] == boxOffY + 1 then
  523.                             listOff = 0
  524.                         elseif event[4] == boxOffY+boxH then
  525.                             listOff = #folders + #files + 1 - boxH
  526.                         else
  527.                             listOff = math.ceil((event[4] - boxOffY - 1 )*(((#folders + #files - boxH+2)/boxH)))
  528.                         end
  529.                     end
  530.                 elseif event[3] == exitX and event[4] == exitY then
  531.                     if dialogBox("Confirm","Exit application",{"yes","no"}) == 1 then
  532.                         bRun = false
  533.                     end
  534.                 end
  535.             elseif event[2] == 2 then -- right mouse
  536.                 local temp = nil
  537.                 if event[4] > boxOffY and event[4] <= boxH + boxOffY then
  538.                     temp = folders[event[4]+listOff-boxOffY] or files[event[4]-#folders+listOff-boxOffY]
  539.                 end
  540.                 if temp and event[3] > boxOffX and event[3] <= #temp + 3 + boxOffX and event[3] < boxOffX + boxW then
  541.                     local sType = "File"
  542.                    
  543.                     if fs.isDir(stringParth()..fSlash..temp) then
  544.                         sType = "Folder"
  545.                     end
  546.                    
  547.                     local sChoice = nil
  548.                    
  549.                     if disks[temp] then
  550.                         sChoice = rClickMenu("Options",{"Open","Eject"},event[3]+1,event[4]+1)
  551.                     else
  552.                         if sType == "Folder" then
  553.                             sChoice = rClickMenu("Options",{"Open","Delete"},event[3]+1,event[4]+1)
  554.                         else
  555.                             sChoice = rClickMenu("Options",{"Run","Run CMD","Edit","Paint","Delete"},event[3]+1,event[4]+1)
  556.                         end
  557.                     end
  558.                    
  559.                     if sChoice == "Open" then
  560.                         table.insert(parth,temp)
  561.                         NewList()
  562.                     elseif sChoice == "Run" then
  563.                         clear()
  564.                         local test,info = shell.run(stringParth()..fSlash..temp)
  565.                         term.setCursorBlink(false)
  566.                         if not test then
  567.                             dialogBox("ERROR",tostring(info),{"ok"})
  568.                         end
  569.                     elseif sChoice == "Run CMD" then
  570.                         clear()
  571.                         print("Enter Commands")
  572.                         local cmd = read()
  573.                         clear()
  574.                         local test,info = shell.run(stringParth()..fSlash..temp,cmd)
  575.                         term.setCursorBlink(false)
  576.                         if not test then
  577.                             dialogBox("ERROR",tostring(info),{"ok"})
  578.                         end
  579.                     elseif sChoice == "Edit" then
  580.                         if sType == "File" then
  581.                             shell.run("edit",stringParth()..fSlash..temp) -- stringParth()..fSlash..temp
  582.                         else
  583.                             dialogBox("ERROR","Can't edit a Folder",{"ok"})
  584.                         end
  585.                     elseif sChoice == "Delete" then
  586.                         if dialogBox("Confirm","Delete "..sType.." "..temp,{"yes","no"}) == 1 then
  587.                             if fs.isReadOnly(stringParth()..fSlash..temp) then
  588.                                 dialogBox("ERROR",sType.." Is read Only",{"ok"})
  589.                             else
  590.                                 fs.delete(stringParth()..fSlash..temp)
  591.                                 NewList()
  592.                             end
  593.                         end
  594.                     elseif sChoice == "Paint" then
  595.                         if sType == "File" then
  596.                             shell.run("paint",stringParth()..fSlash..temp)
  597.                         else
  598.                             dialogBox("ERROR","Can't edit a Folder",{"ok"})
  599.                         end
  600.                     elseif sChoice == "Eject" then
  601.                         if dialogBox("Confirm","Eject disk "..disks[temp].." "..fSlash..temp,{"yes","no"}) == 1 then
  602.                             disk.eject(disks[temp])
  603.                             NewList()
  604.                         end
  605.                     end
  606.                 else
  607.                     table.remove(parth,#parth)
  608.                     NewList()
  609.                 end
  610.             end
  611.         elseif event[1] == "mouse_scroll" then
  612.             listOff = listOff + event[2]
  613.             if listOff < 0 then
  614.                 listOff = 0
  615.             end
  616.             if #folders + #files + 1 - boxH > 0 and listOff > #folders + #files + 1 - boxH then
  617.                 listOff = #folders + #files + 1 - boxH
  618.             elseif listOff > 0 and #folders + #files + 1 - boxH < 0 then
  619.                 listOff = 0
  620.             end
  621.            
  622.         elseif event[1] == "key" then
  623.             --[[
  624.             if event[2] == 200 then boxOffY = boxOffY -1 -- up
  625.             elseif event[2] == 208 then boxOffY = boxOffY +1 -- down
  626.             elseif event[2] == 203 then boxOffX = boxOffX -1 -- left
  627.             elseif event[2] == 205 then boxOffX = boxOffX +1 -- right
  628.             end
  629.             ]]--
  630.             resume(unpack(event))
  631.            
  632.         elseif event[1] == "char" then
  633.             --[[
  634.             if event[2] == "w" then boxH = boxH + 1
  635.             elseif event[2] == "s" then boxH = boxH - 1
  636.             elseif event[2] == "a" then boxW = boxW - 1
  637.             elseif event[2] == "d" then boxW = boxW + 1
  638.             end
  639.             ]]--
  640.             resume(unpack(event))
  641.         elseif event[1] == "disk" or event[1] == "disk_eject" then
  642.             NewList()
  643.         end
  644.         term.setBackgroundColor(colors.black)
  645.         term.clear()
  646.     end
  647. end
  648.  
  649.  
  650.  
  651. clear()
  652.  
  653. fileSelect(mode)
  654. clear()
  655.  
  656.  
  657. --[[
  658. local test = {
  659. {t = "test1",m = "is the working",s = {"yes","no"}},
  660. {t = "test2",m = "is everthing ok",s = {"ok"}},
  661. }
  662.  
  663. for i = 1, #test do
  664.     local n,word = dialogBox(test[i].t,test[i].m,test[i].s)
  665.     print(n.." "..word)
  666. end
  667. ]]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement