From 7e61bffe5f313599423ad3cf88b0e44329de7dd2 Mon Sep 17 00:00:00 2001 From: jussi Date: Sat, 10 Dec 2022 18:47:45 +0200 Subject: RL_GetFileLength. --- src/core.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/core.c') diff --git a/src/core.c b/src/core.c index dd2783a..a4bff1a 100644 --- a/src/core.c +++ b/src/core.c @@ -2069,6 +2069,24 @@ int lcoreIsFileExtension( lua_State *L ) { return 1; } +/* +> length = RL_GetFileLength( string fileName ) + +Get file length in bytes ( NOTE: GetFileSize() conflicts with windows.h ) + +- Failure return false +- Success return int +*/ +int lcoreGetFileLength( lua_State *L ) { + if ( !lua_isstring( L, -1 ) ) { + TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GetFileLength( string fileName )" ); + lua_pushboolean( L, false ); + return 1; + } + lua_pushinteger( L, GetFileLength( lua_tostring( L, -1 ) ) ); + return 1; +} + /* > extension = RL_GetFileExtension( string fileName ) -- cgit v1.2.3