nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 98 lines 2.5 kB view raw
1diff --git a/dub.sdl b/dub.sdl 2index 50c0da1..87936a4 100644 3--- a/dub.sdl 4+++ b/dub.sdl 5@@ -32,6 +32,9 @@ configuration "barebones" { 6 targetType "executable" 7 8 dependency "dportals" version="~>0.1.0" 9+ 10+ subConfiguration "lumars" "lua51-dynamic" 11+ versions "LUA_51" 12 } 13 14 15@@ -51,6 +54,9 @@ configuration "linux-full" { 16 versions "InBranding" 17 18 dependency "dportals" version="~>0.1.0" 19+ 20+ subConfiguration "lumars" "lua51-dynamic" 21+ versions "LUA_51" 22 } 23 24 configuration "osx-full" { 25@@ -84,6 +90,9 @@ configuration "linux-nightly" { 26 versions "InNightly" 27 28 dependency "dportals" version="~>0.1.0" 29+ 30+ subConfiguration "lumars" "lua51-dynamic" 31+ versions "LUA_51" 32 } 33 34 // macOS nightly build 35diff --git a/source/session/plugins/package.d b/source/session/plugins/package.d 36index 965c64f..7cfbb0b 100644 37--- a/source/session/plugins/package.d 38+++ b/source/session/plugins/package.d 39@@ -14,9 +14,9 @@ import lumars; 40 import session.log; 41 import std.file; 42 import std.path; 43+import std.exception; 44 45 private { 46- bool couldLoadLua = true; 47 LuaState* state; 48 LuaTable apiTable; 49 50@@ -34,13 +34,17 @@ Plugin[] insPlugins; 51 Initializes Lua support 52 */ 53 void insLuaInit() { 54- // LuaSupport support = loadLua(); 55- 56- // if (support == LuaSupport.noLibrary || support == LuaSupport.badLibrary) { 57- // couldLoadLua = false; 58- // insLogWarn("Could not load Lua support..."); 59- // } else insLogInfo("Lua support initialized."); 60- insLogInfo("Lua support initialized. (Statically linked for now)"); 61+ version(linux){ 62+ LuaSupport support = loadLua("libluajit-5.1.so.2"); 63+ if(support == LuaSupport.noLibrary){ 64+ support = loadLua(); 65+ } 66+ enforce(support != LuaSupport.noLibrary, "Could not find Lua support...!"); 67+ enforce(support != LuaSupport.badLibrary, "Bad Lua library found!"); 68+ insLogInfo("Lua support initialized."); 69+ } else { 70+ insLogInfo("Lua support initialized. (Statically linked)"); 71+ } 72 73 // Create Lua state 74 state = new LuaState(luaL_newstate()); 75@@ -56,6 +60,9 @@ void insLuaInit() { 76 void insLuaUnload() { 77 lua_close(state.handle()); 78 destroy(state); 79+ version(linux){ 80+ unloadLua(); 81+ } 82 } 83 84 void insSavePluginState() { 85@@ -111,13 +118,6 @@ void insEnumeratePlugins() { 86 insSavePluginState(); 87 } 88 89-/** 90- Gets whether Lua support is loaded. 91-*/ 92-bool insHasLua() { 93- return couldLoadLua; 94-} 95- 96 /** 97 Gets string of value 98 */