Added lua function movie.getfilename() which returns the current movie filename without the path included.

This commit is contained in:
adelikat 2010-05-29 04:06:49 +00:00
parent 626528ade6
commit 7c6c8d0941
3 changed files with 19 additions and 1 deletions

View File

@ -1,3 +1,4 @@
28-may-2010 - adelikat - Added lua function movie.getfilename() which returns the current movie filename without the path included
27-may-2010 - ugetab - Win32 - Debugger - Made debugger able to break on and distinguish Stack reads/writes
24-may-2010 - adelikat - Win32 - Memwatch - ignore spaces at the beginnign of an address in the address boxes
24-may-2010 - mart0258 - Disable auto-savestates during turbo

View File

@ -2146,7 +2146,7 @@ static int input_get(lua_State *L) {
#else
// NYI (well, return an empty table)
// NYI (well, return an empty table) //SDL TODO: implement this!
#endif
return 1;
@ -2695,6 +2695,22 @@ static int movie_getname (lua_State *L) {
return 1;
}
//movie.getfilename
//
//returns the filename of movie loaded with no path
static int movie_getfilename (lua_State *L) {
if (!FCEUMOV_IsRecording() && !FCEUMOV_IsPlaying())
luaL_error(L, "No movie loaded.");
std::string name = FCEUI_GetMovieName();
int x = name.find_last_of("/\\") + 1;
if (x)
name = name.substr(x, name.length()-x);
lua_pushstring(L, name.c_str());
return 1;
}
//movie.replay
//
//calls the play movie from beginning function
@ -4707,6 +4723,7 @@ static const struct luaL_reg movielib[] = {
{"length", movie_getlength},
{"rerecordcount", movie_rerecordcount},
{"name", movie_getname},
{"filename", movie_getfilename},
{"readonly", movie_getreadonly},
{"setreadonly", movie_setreadonly},
{"replay", movie_replay},

Binary file not shown.