Skip to content

Commit 6b78796

Browse files
authored
Make enums and structs in Luau.Require header C compatible (#2060)
1 parent 5836a9c commit 6b78796

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Require/Runtime/include/Luau/Require.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "lua.h"
55

6+
#include <stdbool.h>
67
#include <stddef.h>
78

89
////////////////////////////////////////////////////////////////////////////////
@@ -46,24 +47,24 @@
4647
//
4748
////////////////////////////////////////////////////////////////////////////////
4849

49-
enum luarequire_NavigateResult
50+
typedef enum luarequire_NavigateResult
5051
{
5152
NAVIGATE_SUCCESS,
5253
NAVIGATE_AMBIGUOUS,
5354
NAVIGATE_NOT_FOUND
54-
};
55+
} luarequire_NavigateResult;
5556

5657
// Functions returning WRITE_SUCCESS are expected to set their size_out argument
5758
// to the number of bytes written to the buffer. If WRITE_BUFFER_TOO_SMALL is
5859
// returned, size_out should be set to the required buffer size.
59-
enum luarequire_WriteResult
60+
typedef enum luarequire_WriteResult
6061
{
6162
WRITE_SUCCESS,
6263
WRITE_BUFFER_TOO_SMALL,
6364
WRITE_FAILURE
64-
};
65+
} luarequire_WriteResult;
6566

66-
struct luarequire_Configuration
67+
typedef struct luarequire_Configuration
6768
{
6869
// Returns whether requires are permitted from the given chunkname.
6970
bool (*is_require_allowed)(lua_State* L, void* ctx, const char* requirer_chunkname);
@@ -120,7 +121,7 @@ struct luarequire_Configuration
120121
// thread to yield. In this case, this thread should be resumed with the
121122
// module result pushed onto its stack.
122123
int (*load)(lua_State* L, void* ctx, const char* path, const char* chunkname, const char* loadname);
123-
};
124+
} luarequire_Configuration;
124125

125126
// Populates function pointers in the given luarequire_Configuration.
126127
typedef void (*luarequire_Configuration_init)(luarequire_Configuration* config);

0 commit comments

Comments
 (0)