Posted 23 February 2015 - 12:48 AM
Alright, so I am writing an API for use with my accompanying OS. What I'd like to be able to do is: If the file is just in a directory on the computer and run as a program, it will run a separate function. However if it is called as an API [os.loadAPI()] then I would like it to be able to alternate between API mode and OS mode while still loaded as an API. I don't believe the os.loadAPI() accepts an argument other than the file to load so I would find this slightly more difficult, but here is the general format:
[some program calling the file as an api]
os.loadAPI("myApiOS", 0) –This will run in 'API MODE'
*some code that uses the api*
os.loadAPI("myApiOS", 1) –This will run in 'OS MODE'
*now we are running the OS from the API file, while still being able to call to the api*
[//END]
[just the API/OS file in a directory]]
*runs as if called with os.loadAPI("myApiOS", 1)
[//END]
Also, as I do not actively know of a way that this could be accomplished I would recommend this in the Suggestions for a future update, This would allow all new possibilities with APIs!
I have brainstormed on how I would accomplish this but have failed to get anything that wouldn't by default run the OS.
Any and all help is much appreciated!
[some program calling the file as an api]
os.loadAPI("myApiOS", 0) –This will run in 'API MODE'
*some code that uses the api*
os.loadAPI("myApiOS", 1) –This will run in 'OS MODE'
*now we are running the OS from the API file, while still being able to call to the api*
[//END]
[just the API/OS file in a directory]]
*runs as if called with os.loadAPI("myApiOS", 1)
[//END]
Also, as I do not actively know of a way that this could be accomplished I would recommend this in the Suggestions for a future update, This would allow all new possibilities with APIs!
I have brainstormed on how I would accomplish this but have failed to get anything that wouldn't by default run the OS.
Any and all help is much appreciated!