ComputerCraft Archive

goto snippet

computer utility LDDestroier github

Description

A collection of all my ComputerCraft programs and the APIs they use. This is mostly just to get them the fuck off of pastebin, and also to ensure that API owners don't change things to break my precious programs...!

Installation

Copy one of these commands into your ComputerCraft terminal:

wget:wget https://raw.githubusercontent.com/LDDestroier/CC/master/goto-snippet.lua goto_snippet
Archive:wget https://cc.shobie.xyz/cc/get/gh-LDDestroier-CC-goto-snippet goto_snippet
Quick Install: wget https://cc.shobie.xyz/cc/get/gh-LDDestroier-CC-goto-snippet goto snippet

Usage

Run: goto-snippet

Tags

none

Source

View Original Source

Code Preview

-- goto
goto = function(tag) local f,c,l,o=fs.open(shell.getRunningProgram(), "r"),"","",false while l do if o then c=c..l l=f.readLine() if l then c=c.."\n" else break end else l=f.readLine() if l then o=l:find("--::"..tag.."::")==1 end end end f.close() load(c,nil,nil,_ENV)() end

-- example
goto("test")

print("Before")

--::test::

print("After")

--[[
	After
	Before
	After
--]]