Sign in to follow this  
Friggle

Obtaining a list of all script files

Recommended Posts

Friggle    135
Hi,

I'm looking for a way to obtain a list of all currently loaded script files from the engine (in order to support selecting a file from a list to simplify setting of a breakpoint).
I'm using the ScriptBuilder Add-On to process #includes.

Is there a simple way to retrieve a list of all added script files from the engine, the context or similar? If not, can I possibly generate a list at the point in time when I'm using the ScriptBuilder object in my code?

Thanks so much and regards

Share this post


Link to post
Share on other sites
WitchLord    4678
The script engine doesn't provide a way to enumerate the script sections. That information is best obtained by modifying the CScriptBuilder to give access to the includedScripts member array.

Regards,
Andreas

Share this post


Link to post
Share on other sites
Friggle    135
Hi,

just wanted to wrap this up by describing what I've done, it might be useful for other people:

I now managed to obtain a list of script files from the engine by parsing all global functions and all methods of all classes, basically by using the following subset of interfaces:

[code]
// for each script module...
// global functions:
mod->GetFunctionCount()
// for each function
func = mod->GetFunctionDescriptorByIndex(i)
scriptfileName = func->GetScriptSectionName()
// methods:
obj = mod->GetObjectTypeCount()
// for each class (script object)
objType = mod->GetObjectTypeByIndex(i)
objType->GetMethodCount()
// for each method
func = objType->GetMethodDescriptorByIndex(j)
scriptfileName = func->GetScriptSectionName()
[/code]

This identifies all script section names (i.e. script file names) that contain code in terms of candidates for breakpoints.
Certainly, the script file names pop up multiple times during the search, i.e. must be filtered for uniqueness to obtain a useful selection list for the debugger.

Cheers,
Thomas

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this