Browse Source

Re-enable Lua's default loaders. Register own loader last into the table.

Lasse Öörni 12 years ago
parent
commit
e5b7b6c916
3 changed files with 4 additions and 7 deletions
  1. 2 2
      Source/Extras/LuaScript/LuaScript.cpp
  2. 1 4
      Source/ThirdParty/Lua/src/loadlib.c
  3. 1 1
      cmake_gcc.sh

+ 2 - 2
Source/Extras/LuaScript/LuaScript.cpp

@@ -262,8 +262,8 @@ void LuaScript::RegisterLoader()
     lua_getglobal(luaState_, "package");
     lua_getfield(luaState_, -1, "loaders");
 
-    // Set package.loaders[1]
-    lua_pushinteger(luaState_, 1);
+    // Add our loader to the end of the table
+    lua_pushinteger(luaState_, lua_objlen(luaState_, -1) + 1);
     lua_pushcfunction(luaState_, &LuaScript::Loader);
     lua_settable(luaState_, -3);
     lua_pop(luaState_, 2);

+ 1 - 4
Source/ThirdParty/Lua/src/loadlib.c

@@ -8,8 +8,6 @@
 ** implementation for Windows, and a stub for other systems.
 */
 
-// Modified by Lasse Oorni for Urho3D
-
 #include <stdlib.h>
 #include <string.h>
 
@@ -621,9 +619,8 @@ static const luaL_Reg ll_funcs[] = {
 };
 
 
-// Urho3D: disable inbuilt loaders
 static const lua_CFunction loaders[] =
-  {/*loader_preload, loader_Lua, loader_C, loader_Croot,*/ NULL};
+  {loader_preload, loader_Lua, loader_C, loader_Croot, NULL};
 
 
 LUALIB_API int luaopen_package (lua_State *L) {

+ 1 - 1
cmake_gcc.sh

@@ -22,7 +22,7 @@
 
 # Define helpers
 msg() {
-    echo -e "\n$1\n==============================================================================="
+    echo -e "\n$1\n================================================================================"
 }
 
 post_cmake() {