Post Reply 
How can I maintain a variables value when editing a Program or App
12-17-2014, 07:37 PM (This post was last modified: 12-17-2014 07:55 PM by Snorre.)
Post: #3
RE: How can I maintain a variables value when editing a Program or App
Hello,

a dirty solution may look like:
Code:
x:=1,y:=2,z:=3;
// DO NOT TOUCH THIS COMMENT!

EXPORT SELFMODIFY()
BEGIN
  INPUT({x,y,z});  // ... or whatever you want to do with your vars.
  LOCAL code:=Programs("SELFMODIFY");
  LOCAL pos:=INSTRING(code,"// DO NOT TOUCH THIS COMMENT!");
  Programs("SELFMODIFY"):=
    "x:="+STRING(x)+",y:="+STRING(y)+",z:="+STRING(z)+";"+CHAR(10)+
    MID(code,pos,SIZE(code)-pos+1);
END;
This doesn't need external variables or notes since it modifies its own source (assuming the program is named "SELFMODIFY").
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: How can I maintain a variables value when editing a Program or App - Snorre - 12-17-2014 07:37 PM



User(s) browsing this thread: 1 Guest(s)