MRI: add option to use a script's name as filename

This commit is contained in:
cremno 2014-04-11 18:11:32 +02:00
parent 8bc17a9a98
commit 95c112bbe4
4 changed files with 24 additions and 5 deletions

View file

@ -295,11 +295,20 @@ static void runRMXPScripts()
VALUE string = newStringUTF8(RSTRING_PTR(scriptDecoded),
RSTRING_LEN(scriptDecoded));
char fname[32];
int len = snprintf(fname, sizeof(fname), "Section%03ld", i);
VALUE fname;
if (shState->rtData().config.useScriptNames)
{
fname = rb_ary_entry(script, 1);
}
else
{
char buf[32];
int len = snprintf(buf, sizeof(buf), "Section%03ld", i);
fname = newStringUTF8(buf, len);
}
int state;
evalString(string, newStringUTF8(fname, len), &state);
evalString(string, fname, &state);
if (state)
break;
}