@@ -56,19 +56,19 @@ pub struct luarequire_Configuration {
5656 // Returns whether the context is currently pointing at a module.
5757 pub is_module_present : unsafe extern "C" fn ( L : * mut lua_State , ctx : * mut c_void ) -> bool ,
5858
59- // Provides the contents of the current module. This function is only called if is_module_present returns
60- // true.
61- pub get_contents : unsafe extern "C" fn (
59+ // Provides a chunkname for the current module. This will be accessible through the debug library. This
60+ // function is only called if is_module_present returns true.
61+ pub get_chunkname : unsafe extern "C" fn (
6262 L : * mut lua_State ,
6363 ctx : * mut c_void ,
6464 buffer : * mut c_char ,
6565 buffer_size : usize ,
6666 size_out : * mut usize ,
6767 ) -> luarequire_WriteResult ,
6868
69- // Provides a chunkname for the current module. This will be accessible through the debug library . This
70- // function is only called if is_module_present returns true.
71- pub get_chunkname : unsafe extern "C" fn (
69+ // Provides a loadname that identifies the current module and is passed to load . This function
70+ // is only called if is_module_present returns true.
71+ pub get_loadname : unsafe extern "C" fn (
7272 L : * mut lua_State ,
7373 ctx : * mut c_void ,
7474 buffer : * mut c_char ,
@@ -91,15 +91,34 @@ pub struct luarequire_Configuration {
9191 // NAVIGATE_FAILURE is returned (at root).
9292 pub is_config_present : unsafe extern "C" fn ( L : * mut lua_State , ctx : * mut c_void ) -> bool ,
9393
94- // Provides the contents of the configuration file in the current context.
95- // This function is only called if is_config_present returns true.
96- pub get_config : unsafe extern "C" fn (
97- L : * mut lua_State ,
98- ctx : * mut c_void ,
99- buffer : * mut c_char ,
100- buffer_size : usize ,
101- size_out : * mut usize ,
102- ) -> luarequire_WriteResult ,
94+ // Parses the configuration file in the current context for the given alias and returns its
95+ // value or WRITE_FAILURE if not found. This function is only called if is_config_present
96+ // returns true. If this function pointer is set, get_config must not be set. Opting in to this
97+ // function pointer disables parsing configuration files internally and can be used for finer
98+ // control over the configuration file parsing process.
99+ pub get_alias : Option <
100+ unsafe extern "C" fn (
101+ L : * mut lua_State ,
102+ ctx : * mut c_void ,
103+ alias : * const c_char ,
104+ buffer : * mut c_char ,
105+ buffer_size : usize ,
106+ size_out : * mut usize ,
107+ ) -> luarequire_WriteResult ,
108+ > ,
109+
110+ // Provides the contents of the configuration file in the current context. This function is only called
111+ // if is_config_present returns true. If this function pointer is set, get_alias must not be set. Opting
112+ // in to this function pointer enables parsing configuration files internally.
113+ pub get_config : Option <
114+ unsafe extern "C" fn (
115+ L : * mut lua_State ,
116+ ctx : * mut c_void ,
117+ buffer : * mut c_char ,
118+ buffer_size : usize ,
119+ size_out : * mut usize ,
120+ ) -> luarequire_WriteResult ,
121+ > ,
103122
104123 // Executes the module and places the result on the stack. Returns the number of results placed on the
105124 // stack.
@@ -110,7 +129,7 @@ pub struct luarequire_Configuration {
110129 ctx : * mut c_void ,
111130 path : * const c_char ,
112131 chunkname : * const c_char ,
113- contents : * const c_char ,
132+ loadname : * const c_char ,
114133 ) -> c_int ,
115134}
116135
0 commit comments