@@ -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 ;
@@ -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