Original Post
Hello everyone! I have another fairly trivial question to ask.
As per suggestion last time, I decided to go with an existing scripting language instead of rolling my own. I've realized by now that that was ultimately a better decision.
Now, I am trying to build into my game editor a scripting section which will allow the user to modify the functions inside a script (some functions are generated by the GUI builder and other behavior can be programmed by the user). Creating the editor inside the builder and writing the code to save the text from the editor in the proper place in the file was a triviality. Now, I need to be able to read the code back and separate it by function.
My question is, is there some way I could use the jython interpreter, which I got from http://www.jython.org/, to handle this? I'm trying not to write a special parser just so I can separate the code properly. I know I can read in a class into an object (the level script contains a single class that describes the level) and operate on the separate functions, but is there any way to get the function code from that object in String format?
As per suggestion last time, I decided to go with an existing scripting language instead of rolling my own. I've realized by now that that was ultimately a better decision.
Now, I am trying to build into my game editor a scripting section which will allow the user to modify the functions inside a script (some functions are generated by the GUI builder and other behavior can be programmed by the user). Creating the editor inside the builder and writing the code to save the text from the editor in the proper place in the file was a triviality. Now, I need to be able to read the code back and separate it by function.
My question is, is there some way I could use the jython interpreter, which I got from http://www.jython.org/, to handle this? I'm trying not to write a special parser just so I can separate the code properly. I know I can read in a class into an object (the level script contains a single class that describes the level) and operate on the separate functions, but is there any way to get the function code from that object in String format?