Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Program Updater v2

edited March 2013 in General Posts: 13

Feel free to copy and use

--Anonycodes Program Updater

function setup()

--1) insert this 

--into the base of your program

--the very bottom of the screen where your code is?
--this works best if all code is in the same tab and there are no other tabs

--2) run your code once you have completed step 1

--3) then come back to this program and run it
--All of your project's updated code should be displayed in the Output window
--as a single cell

--4) tap that cell to copy it
--5) either create a new project 
--or go back to the project you grabbed it from, 
--do a select all, and paste it back into it

--Note: When you select all of your old code? 
--don't copy it or else you'll erase the newly 
--updated code from your pasteboard 
--and you'll have to repeat steps 3 and 4 to get the updated code

--to Erase: a copy of the code will still remain 
--in the saveGlobalData buffer as "theprogram"
--until you decide to specify a new one by repeating steps 1 and 2 with another project
--only then will it be erased from the buffer.

theprogram = readGlobalData("theprogram")

theprogram = string.sub(theprogram,1,string.find(theprogram,"%S$") - 52)

theprogram = string.gsub(theprogram,"parameter","parameter.number")
theprogram = string.gsub(theprogram,"iparameter","parameter.integer")
--iparameter error handling for previous miscoded
theprogram = string.gsub(theprogram,"parameter.number.integer","parameter.integer")
theprogram = string.gsub(theprogram,"parameter.integer.number","parameter.integer")

theprogram = string.gsub(theprogram,"clearParameters","parameter.clear")
theprogram = string.gsub(theprogram,"clearOutput","output.clear")
theprogram = string.sub(theprogram,1,-11)


Sign In or Register to comment.