@@ -48,10 +48,6 @@ extern const size_t LUA_INIT_SCRIPT_SIZE;
4848 HGDN_PRINT_ERROR(prefix ": %s", lua_tostring(L, -1)); \
4949 lua_pop(L, 1)
5050
51- #ifdef LUAJIT_DYNAMICALLY_LINKED
52- // Active shared library path, for loading symbols in FFI
53- static hgdn_string lps_active_library_path ;
54- #endif
5551static bool lps_in_editor ;
5652static int lps_pcall_error_handler_index ;
5753static lua_State * lps_L ;
@@ -136,12 +132,12 @@ static godot_pluginscript_language_data *lps_language_init() {
136132 lua_setfield (L , LUA_REGISTRYINDEX , PLUGINSCRIPT_CALLBACKS_KEY );
137133
138134 lua_pushboolean (L , lps_in_editor );
139- #ifdef LUAJIT_DYNAMICALLY_LINKED
140- lua_pushlstring (L , lps_active_library_path . ptr , lps_active_library_path . length );
141- #else
142- lua_pushnil ( L );
143- #endif
144- if (lua_pcall (L , 3 , 0 , lps_pcall_error_handler_index ) != LUA_OK ) {
135+ lua_pushlightuserdata ( L , ( void * ) hgdn_core_api );
136+ lua_pushlightuserdata (L , ( void * ) hgdn_core_1_1_api );
137+ lua_pushlightuserdata ( L , ( void * ) hgdn_core_1_2_api );
138+ lua_pushlightuserdata ( L , ( void * ) hgdn_core_1_3_api );
139+ lua_pushlightuserdata ( L , ( void * ) hgdn_library );
140+ if (lua_pcall (L , 7 , 0 , lps_pcall_error_handler_index ) != LUA_OK ) {
145141 LPS_PCALL_CONSUME_ERROR (L , "Error in Lua language initialization script" );
146142 }
147143 return L ;
@@ -276,7 +272,7 @@ static void lps_instance_notification(godot_pluginscript_instance_data *data, in
276272}
277273
278274// In-editor callbacks
279- godot_string lps_get_template_source_code (godot_pluginscript_language_data * data , const godot_string * class_name , const godot_string * base_class_name ) {
275+ static godot_string lps_get_template_source_code (godot_pluginscript_language_data * data , const godot_string * class_name , const godot_string * base_class_name ) {
280276 godot_string ret ;
281277 hgdn_core_api -> godot_string_new (& ret );
282278 LPS_PUSH_CALLBACK (lps_L , "get_template_source_code" );
@@ -289,7 +285,7 @@ godot_string lps_get_template_source_code(godot_pluginscript_language_data *data
289285 return ret ;
290286}
291287
292- godot_bool lps_validate (godot_pluginscript_language_data * data , const godot_string * script , int * line_error , int * col_error , godot_string * test_error , const godot_string * path , godot_pool_string_array * functions ) {
288+ static godot_bool lps_validate (godot_pluginscript_language_data * data , const godot_string * script , int * line_error , int * col_error , godot_string * test_error , const godot_string * path , godot_pool_string_array * functions ) {
293289 LPS_PUSH_CALLBACK (lps_L , "validate" );
294290 lua_pushlightuserdata (lps_L , (void * ) script );
295291 lua_pushlightuserdata (lps_L , (void * ) line_error );
@@ -306,7 +302,7 @@ godot_bool lps_validate(godot_pluginscript_language_data *data, const godot_stri
306302 return success ;
307303}
308304
309- godot_string lps_make_function (godot_pluginscript_language_data * data , const godot_string * class_name , const godot_string * name , const godot_pool_string_array * args ) {
305+ static godot_string lps_make_function (godot_pluginscript_language_data * data , const godot_string * class_name , const godot_string * name , const godot_pool_string_array * args ) {
310306 godot_string ret ;
311307 hgdn_core_api -> godot_string_new (& ret );
312308 LPS_PUSH_CALLBACK (lps_L , "make_function" );
@@ -320,7 +316,7 @@ godot_string lps_make_function(godot_pluginscript_language_data *data, const god
320316 return ret ;
321317}
322318
323- void lps_register_in_editor_callbacks (godot_pluginscript_language_desc * desc ) {
319+ static void lps_register_in_editor_callbacks (godot_pluginscript_language_desc * desc ) {
324320 desc -> get_template_source_code = & lps_get_template_source_code ;
325321 desc -> validate = & lps_validate ;
326322 desc -> make_function = & lps_make_function ;
@@ -384,31 +380,10 @@ GDN_EXPORT void PREFIX_SYMBOL(gdnative_init)(godot_gdnative_init_options *option
384380 lps_register_in_editor_callbacks (& lps_language_desc );
385381 }
386382
387- #ifdef LUAJIT_DYNAMICALLY_LINKED
388- godot_object * OS = hgdn_core_api -> godot_global_get_singleton ("OS" );
389- if (hgdn_variant_get_bool_own (hgdn_object_call (OS , "has_feature" , "standalone" ))) {
390- godot_variant exepath_var = hgdn_object_callv (OS , "get_executable_path" , NULL );
391- godot_string exepath = hgdn_core_api -> godot_variant_as_string (& exepath_var );
392- godot_string exedir = hgdn_core_api -> godot_string_get_base_dir (& exepath );
393- godot_string library_filepath = hgdn_core_api -> godot_string_get_file (options -> active_library_path );
394- lps_active_library_path = hgdn_string_get_own (hgdn_core_api -> godot_string_plus_file (& exedir , & library_filepath ));
395- hgdn_core_api -> godot_string_destroy (& library_filepath );
396- hgdn_core_api -> godot_string_destroy (& exedir );
397- hgdn_core_api -> godot_string_destroy (& exepath );
398- hgdn_core_api -> godot_variant_destroy (& exepath_var );
399- }
400- else {
401- lps_active_library_path = hgdn_string_get (options -> active_library_path );
402- }
403- #endif
404-
405383 hgdn_pluginscript_api -> godot_pluginscript_register_language (& lps_language_desc );
406384}
407385
408386GDN_EXPORT void PREFIX_SYMBOL (gdnative_terminate )(godot_gdnative_terminate_options * options ) {
409- #ifdef LUAJIT_DYNAMICALLY_LINKED
410- hgdn_string_destroy (& lps_active_library_path );
411- #endif
412387 hgdn_gdnative_terminate (options );
413388}
414389
0 commit comments