22 posts
Posted 02 August 2012 - 08:17 AM
I'm not sure exactly how to explain this, and will try to be as clear as possible, and forgive me if there is a really simple answer to this that I'm not seeing, but is there any way that I can use one program to add code to another program? For example, lets say I made a small game called Shooter, where you shot aliens, and another program was an expansion pack called Levels Pack 1, that added more levels to the game, that I was on a Floppy Disk. I would put in the Floppy, and then it would go into Shooter's file, and add the info for the new levels into the end of the original games code. Something like this would be good for people who want to release expansions or updates to programs they've made very easily!
53 posts
Location
London, UK
Posted 02 August 2012 - 09:07 AM
Alternatively, you could have the expansion levels in separate files, so when the user selects that expansion, you use 'shell.run()' to run the level.
When you install the expansion pack, it doesn't have to put data into the existing files, but it could copy the new level files from the floppy to the PC.
To make the menu items only appear when the expansion has been installed, you could use 'fs.exists()' to check whether the new level files are on the PC or not.
1111 posts
Location
Portland OR
Posted 02 August 2012 - 09:36 AM
It may get kind of messy but you could have it so that the program reads the original program into a table and then use table.insert() to add the lines to the code.
864 posts
Location
Sometime.
Posted 02 August 2012 - 12:43 PM
The program "edit" is the program that edits a program.
EDIT: Look at it's code to see how you would do so.
53 posts
Location
London, UK
Posted 02 August 2012 - 04:10 PM
The program "edit" is the program that edits a program.
EDIT: Look at it's code to see how you would do so.
It seems so obvious now…