ADD: Lua - ExtractFile* functions

This commit is contained in:
Alexander Koblov 2019-03-23 11:32:24 +00:00
commit 407d4d4b0d

View file

@ -134,6 +134,36 @@ begin
lua_pushboolean(L, mbDirectoryExists(lua_tostring(L, 1)));
end;
function luaExtractFilePath(L : Plua_State) : Integer; cdecl;
begin
Result:= 1;
lua_pushstring(L, ExtractFilePath(lua_tostring(L, 1)));
end;
function luaExtractFileDrive(L : Plua_State) : Integer; cdecl;
begin
Result:= 1;
lua_pushstring(L, ExtractFileDrive(lua_tostring(L, 1)));
end;
function luaExtractFileName(L : Plua_State) : Integer; cdecl;
begin
Result:= 1;
lua_pushstring(L, ExtractFileName(lua_tostring(L, 1)));
end;
function luaExtractFileExt(L : Plua_State) : Integer; cdecl;
begin
Result:= 1;
lua_pushstring(L, ExtractFileExt(lua_tostring(L, 1)));
end;
function luaExtractFileDir(L : Plua_State) : Integer; cdecl;
begin
Result:= 1;
lua_pushstring(L, ExtractFileDir(lua_tostring(L, 1)));
end;
function luaPos(L : Plua_State) : Integer; cdecl;
var
Offset: SizeInt = 1;
@ -358,6 +388,13 @@ begin
luaP_register(L, 'FileGetAttr', @luaFileGetAttr);
luaP_register(L, 'GetTickCount', @luaGetTickCount);
luaP_register(L, 'DirectoryExists', @luaDirectoryExists);
luaP_register(L, 'ExtractFileExt', @luaExtractFileExt);
luaP_register(L, 'ExtractFileDir', @luaExtractFileDir);
luaP_register(L, 'ExtractFilePath', @luaExtractFilePath);
luaP_register(L, 'ExtractFileName', @luaExtractFileName);
luaP_register(L, 'ExtractFileDrive', @luaExtractFileDrive);
luaC_register(L, 'PathDelim', PathDelim);
lua_setglobal(L, 'SysUtils');