Index: code/branches/gamestate/data/lua/Debugger.lua
===================================================================
--- code/branches/gamestate/data/lua/Debugger.lua	(revision 6625)
+++ code/branches/gamestate/data/lua/Debugger.lua	(revision 6626)
@@ -2,4 +2,5 @@
 --{{{  history
 
+--28/03/10 ORX Adjusted show() to work with the Orxonox resource system
 --15/03/06 DCN Created based on RemDebug
 --28/04/06 DCN Update for Lua 5.1
@@ -396,44 +397,58 @@
   after  = tonumber(after  or before)
 
-  if not string.find(file,'%.') then file = file..'.lua' end
-
-  local f = io.open(file,'r')
-  if not f then
-    --{{{  try to find the file in the path
+  -- Try to find the file in the Orxonox resources
+  local text = luaState:getSourceCode(file)
+
+  if text == "" then
+    if not string.find(file,'%.') then file = file..'.lua' end
+
+    local f = io.open(file,'r')
+    if not f then
+      --{{{  try to find the file in the path
     
-    --
-    -- looks for a file in the package path
-    --
-    local path = package.path or LUA_PATH or ''
-    for c in string.gmatch (path, "[^;]+") do
-      local c = string.gsub (c, "%?%.lua", file)
-      f = io.open (c,'r')
+      --
+      -- looks for a file in the package path
+      --
+      local path = package.path or LUA_PATH or ''
+      for c in string.gmatch (path, "[^;]+") do
+        local c = string.gsub (c, "%?%.lua", file)
+        f = io.open (c,'r')
+        if f then
+          break
+        end
+      end
+    
+      --}}}
+
       if f then
-        break
-      end
-    end
-    
-    --}}}
-    if not f then
-      io.write('Cannot find '..file..'\n')
-      return
-    end
-  end
-
+        -- Read file into 'text'
+        text = f:read("*a")
+        f:close()
+      else
+        io.write('Cannot find '..file..'\n')
+        return
+      end
+    end
+  end
+
+  -- Transform line endings to \n
+  text :gsub("\r\n", "\n") -- Windows to Unix
+  text:gsub("\r", "\n")   -- Mac to Unix
+  if text[-1] ~= "\n" then
+      text = text.."\n"
+  end
+  -- Print requested lines
   local i = 0
-  for l in f:lines() do
+  for l in text:gmatch("[^\n]*[\n]") do
     i = i + 1
     if i >= (line-before) then
       if i > (line+after) then break end
       if i == line then
-        io.write(i..'***\t'..l..'\n')
-      else
-        io.write(i..'\t'..l..'\n')
-      end
-    end
-  end
-
-  f:close()
-
+        io.write(i..'***\t'..l)
+      else
+        io.write(i..'\t'..l)
+      end
+    end
+  end
 end
 
@@ -611,5 +626,6 @@
     file = string.sub(file, 2)
   end
-  if IsWindows then file = string.lower(file) end
+  -- Orxonox changes: Our resource system is case sensisive, even on Windows
+  --if IsWindows then file = string.lower(file) end
 
   if not line then
Index: code/branches/gamestate/src/libraries/core/LuaState.cc
===================================================================
--- code/branches/gamestate/src/libraries/core/LuaState.cc	(revision 6625)
+++ code/branches/gamestate/src/libraries/core/LuaState.cc	(revision 6626)
@@ -135,14 +135,14 @@
 
         std::string chunkname;
-        if (sourceFileInfo != NULL && !sourceFileInfo->fileSystemPath.empty())
+        if (sourceFileInfo != NULL)
         {
             // Provide lua_load with the filename for debug purposes
             // The '@' is a Lua convention to identify the chunk name as filename
-            chunkname = '@' + sourceFileInfo->fileSystemPath;
-        }
-        else
-        {
-            // Use the beginning of the code string to identify the chunk
-            chunkname = code.substr(0, 80);
+            chunkname = '@' + sourceFileInfo->filename;
+        }
+        else
+        {
+            // Use the code string to identify the chunk
+            chunkname = code;
         }
 
@@ -195,4 +195,14 @@
     }
 
+    //! Returns the content of a file
+    std::string LuaState::getSourceCode(const std::string& filename)
+    {
+        shared_ptr<ResourceInfo> info = Resource::getInfo(filename);
+        if (info == NULL)
+            return "";
+        else
+            return Resource::open(info)->getAsString();
+    }
+
 #if LUA_VERSION_NUM != 501
     const char * LuaState::lua_Chunkreader(lua_State *L, void *data, size_t *size)
Index: code/branches/gamestate/src/libraries/core/LuaState.h
===================================================================
--- code/branches/gamestate/src/libraries/core/LuaState.h	(revision 6625)
+++ code/branches/gamestate/src/libraries/core/LuaState.h	(revision 6626)
@@ -80,4 +80,5 @@
         void luaLog(unsigned int level, const std::string& message); // tolua_export
         bool fileExists(const std::string& filename); // tolua_export
+        std::string getSourceCode(const std::string& filename); // tolua_export
 
         const std::stringstream& getOutput() const { return output_; }
