mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Imported some of the dynamiccore branch from love-experiments:
- Type names for love's Lua objects are specified as an argument to luax_register_type, rather than being statically defined in an array. - luax_register_type takes a variable number of method array arguments, for registering superclass methods without copying them into the subclass' method array. Also removed most of the header declarations for wrapper functions.
This commit is contained in:
@@ -31,31 +31,9 @@ DroppedFile *luax_checkdroppedfile(lua_State *L, int idx)
|
||||
return luax_checktype<DroppedFile>(L, idx, FILESYSTEM_DROPPED_FILE_ID);
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
// Inherits from File.
|
||||
{ "getSize", w_File_getSize },
|
||||
{ "open", w_File_open },
|
||||
{ "close", w_File_close },
|
||||
{ "isOpen", w_File_isOpen },
|
||||
{ "read", w_File_read },
|
||||
{ "write", w_File_write },
|
||||
{ "flush", w_File_flush },
|
||||
{ "isEOF", w_File_isEOF },
|
||||
{ "tell", w_File_tell },
|
||||
{ "seek", w_File_seek },
|
||||
{ "lines", w_File_lines },
|
||||
{ "setBuffer", w_File_setBuffer },
|
||||
{ "getBuffer", w_File_getBuffer },
|
||||
{ "getMode", w_File_getMode },
|
||||
{ "getFilename", w_File_getFilename },
|
||||
{ "getExtension", w_File_getExtension },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
extern "C" int luaopen_droppedfile(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, FILESYSTEM_DROPPED_FILE_ID, functions);
|
||||
return luax_register_type(L, FILESYSTEM_DROPPED_FILE_ID, "DroppedFile", w_File_functions, nullptr);
|
||||
}
|
||||
|
||||
} // filesystem
|
||||
|
||||
@@ -413,7 +413,7 @@ int w_File_getExtension(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
const luaL_Reg w_File_functions[] =
|
||||
{
|
||||
{ "getSize", w_File_getSize },
|
||||
{ "open", w_File_open },
|
||||
@@ -436,7 +436,7 @@ static const luaL_Reg functions[] =
|
||||
|
||||
extern "C" int luaopen_file(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, FILESYSTEM_FILE_ID, functions);
|
||||
return luax_register_type(L, FILESYSTEM_FILE_ID, "File", w_File_functions, nullptr);
|
||||
}
|
||||
|
||||
} // filesystem
|
||||
|
||||
@@ -34,25 +34,11 @@ namespace filesystem
|
||||
int luax_ioError(lua_State *L, const char *fmt, ...);
|
||||
|
||||
File *luax_checkfile(lua_State *L, int idx);
|
||||
int w_File_getSize(lua_State *L);
|
||||
int w_File_open(lua_State *L);
|
||||
int w_File_close(lua_State *L);
|
||||
int w_File_isOpen(lua_State *L);
|
||||
int w_File_read(lua_State *L);
|
||||
int w_File_write(lua_State *L);
|
||||
int w_File_flush(lua_State *L);
|
||||
int w_File_isEOF(lua_State *L);
|
||||
int w_File_tell(lua_State *L);
|
||||
int w_File_seek(lua_State *L);
|
||||
int w_File_lines_i(lua_State *L);
|
||||
int w_File_lines(lua_State *L);
|
||||
int w_File_setBuffer(lua_State *L);
|
||||
int w_File_getBuffer(lua_State *L);
|
||||
int w_File_getMode(lua_State *L);
|
||||
int w_File_getFilename(lua_State *L);
|
||||
int w_File_getExtension(lua_State *L);
|
||||
extern "C" int luaopen_file(lua_State *L);
|
||||
|
||||
extern const luaL_Reg w_File_functions[];
|
||||
|
||||
} // filesystem
|
||||
} // love
|
||||
|
||||
|
||||
@@ -48,11 +48,6 @@ int w_FileData_getExtension(lua_State *L)
|
||||
|
||||
static const luaL_Reg w_FileData_functions[] =
|
||||
{
|
||||
// Data
|
||||
{ "getString", w_Data_getString },
|
||||
{ "getPointer", w_Data_getPointer },
|
||||
{ "getSize", w_Data_getSize },
|
||||
|
||||
{ "getFilename", w_FileData_getFilename },
|
||||
{ "getExtension", w_FileData_getExtension },
|
||||
|
||||
@@ -61,7 +56,7 @@ static const luaL_Reg w_FileData_functions[] =
|
||||
|
||||
extern "C" int luaopen_filedata(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, FILESYSTEM_FILE_DATA_ID, w_FileData_functions);
|
||||
return luax_register_type(L, FILESYSTEM_FILE_DATA_ID, "FileData", w_Data_functions, w_FileData_functions, nullptr);
|
||||
}
|
||||
|
||||
} // filesystem
|
||||
|
||||
@@ -31,8 +31,6 @@ namespace filesystem
|
||||
{
|
||||
|
||||
FileData *luax_checkfiledata(lua_State *L, int idx);
|
||||
int w_FileData_getFilename(lua_State *L);
|
||||
int w_FileData_getExtension(lua_State *L);
|
||||
extern "C" int luaopen_filedata(lua_State *L);
|
||||
|
||||
} // filesystem
|
||||
|
||||
@@ -40,43 +40,6 @@ namespace filesystem
|
||||
FileData *luax_getfiledata(lua_State *L, int idx);
|
||||
|
||||
bool hack_setupWriteDirectory();
|
||||
int w_init(lua_State *L);
|
||||
int w_setFused(lua_State *L);
|
||||
int w_isFused(lua_State *L);
|
||||
int w_setIdentity(lua_State *L);
|
||||
int w_getIdentity(lua_State *L);
|
||||
int w_setSource(lua_State *L);
|
||||
int w_getSource(lua_State *L);
|
||||
int w_mount(lua_State *L);
|
||||
int w_unmount(lua_State *L);
|
||||
int w_newFile(lua_State *L);
|
||||
int w_newFileData(lua_State *L);
|
||||
int w_getWorkingDirectory(lua_State *L);
|
||||
int w_getUserDirectory(lua_State *L);
|
||||
int w_getAppdataDirectory(lua_State *L);
|
||||
int w_getSaveDirectory(lua_State *L);
|
||||
int w_getSourceBaseDirectory(lua_State *L);
|
||||
int w_getRealDirectory(lua_State *L);
|
||||
int w_getExecutablePath(lua_State *L);
|
||||
int w_isDirectory(lua_State *L);
|
||||
int w_isFile(lua_State *L);
|
||||
int w_createDirectory(lua_State *L);
|
||||
int w_remove(lua_State *L);
|
||||
int w_open(lua_State *L);
|
||||
int w_close(lua_State *L);
|
||||
int w_read(lua_State *L);
|
||||
int w_write(lua_State *L);
|
||||
int w_append(lua_State *L);
|
||||
int w_getDirectoryItems(lua_State *L);
|
||||
int w_lines(lua_State *L);
|
||||
int w_load(lua_State *L);
|
||||
int w_getLastModified(lua_State *L);
|
||||
int w_getSize(lua_State *L);
|
||||
int w_setSymlinksEnabled(lua_State *L);
|
||||
int w_areSymlinksEnabled(lua_State *L);
|
||||
int w_isSymlink(lua_State *L);
|
||||
int w_getRequirePath(lua_State *L);
|
||||
int w_setRequirePath(lua_State *L);
|
||||
int loader(lua_State *L);
|
||||
int extloader(lua_State *L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_filesystem(lua_State *L);
|
||||
|
||||
Reference in New Issue
Block a user