Browse Source

Merge branch 'master' into shader-refactor

Lasse Öörni 12 years ago
parent
commit
85146c5317

+ 8 - 4
Source/Engine/LuaScript/LuaScript.cpp

@@ -272,13 +272,17 @@ int LuaScript::Loader(lua_State* L)
     // Get module name.
     // Get module name.
     const char* name = luaL_checkstring(L, 1);
     const char* name = luaL_checkstring(L, 1);
 
 
+    // Get Luc file from module name.
+    LuaFile* lucFile = cache->GetResource<LuaFile>(String(name) + ".luc");
+    if (lucFile)
+        return lucFile->LoadChunk(L) ? 1 : 0;
+
     // Get Lua file from module name.
     // Get Lua file from module name.
     LuaFile* luaFile = cache->GetResource<LuaFile>(String(name) + ".lua");
     LuaFile* luaFile = cache->GetResource<LuaFile>(String(name) + ".lua");
-    if (!luaFile)
-        return false;
+    if (luaFile)
+        return luaFile->LoadChunk(L) ? 1 : 0;
 
 
-    // Load Lua file to Lua chunk.
-    return luaFile->LoadChunk(L) ? 1 : 0;
+    return false;
 }
 }
 
 
 void LuaScript::ReplacePrint()
 void LuaScript::ReplacePrint()

+ 20 - 1
Source/Engine/LuaScript/pkgs/pkgToDox.lua

@@ -7,8 +7,9 @@ end
 pkgFiles = {}
 pkgFiles = {}
 enums = {}
 enums = {}
 classes = {}
 classes = {}
-globalConstants = {}
 globalFunctions = {}
 globalFunctions = {}
+globalProperties = {}
+globalConstants = {}
 renamings = {}
 renamings = {}
 
 
 -- trim string.
 -- trim string.
@@ -122,6 +123,8 @@ function handleLine(line)
         
         
         if line:find(")") ~= nil then -- global function.
         if line:find(")") ~= nil then -- global function.
             table.insert(globalFunctions, line)
             table.insert(globalFunctions, line)
+        elseif line:find("tolua_property") ~= nil then -- global properties
+            table.insert(globalProperties, line)
         else
         else
             local i, _, oldName, newName = line:find("$renaming%s+(.-)%s*@%s*(.-)%s*$") 
             local i, _, oldName, newName = line:find("$renaming%s+(.-)%s*@%s*(.-)%s*$") 
             if i ~= nill then -- renaming types.
             if i ~= nill then -- renaming types.
@@ -191,6 +194,21 @@ function writeGlobalFunctions(ofile)
     ofile:write("\n")
     ofile:write("\n")
 end
 end
 
 
+function writeGlobalProperties(ofile)
+    ofile:write("\\\section LuaScriptAPI_GlobalProperties Global properties\n")
+    for _, line in ipairs(globalProperties) do
+        line = line:gsub("tolua_property__get_set ", "")
+        line = line:gsub(";", "")
+        if line:find("tolua_readonly") == nil then
+            ofile:write("- ", line, "\n")
+        else
+            line = line:gsub("tolua_readonly ", "")
+            ofile:write("- ", line, " (readonly)\n")
+        end
+    end
+    ofile:write("\n")
+end
+
 function writeGlobalConstants(ofile)
 function writeGlobalConstants(ofile)
     ofile:write("\\section LuaScriptAPI_GlobalConstants Global constants\n")
     ofile:write("\\section LuaScriptAPI_GlobalConstants Global constants\n")
     for _, line in ipairs(globalConstants) do
     for _, line in ipairs(globalConstants) do
@@ -284,6 +302,7 @@ ofile:write("\n")
 writeClasses(ofile)
 writeClasses(ofile)
 writeEnums(ofile)
 writeEnums(ofile)
 writeGlobalFunctions(ofile)
 writeGlobalFunctions(ofile)
+writeGlobalProperties(ofile)
 writeGlobalConstants(ofile)
 writeGlobalConstants(ofile)
 writeRenamings(ofile)
 writeRenamings(ofile)
 
 

+ 1 - 1
Source/Tools/Urho3DPlayer/Urho3DPlayer.cpp

@@ -112,7 +112,7 @@ void Urho3DPlayer::Setup()
 void Urho3DPlayer::Start()
 void Urho3DPlayer::Start()
 {
 {
     String extension = GetExtension(scriptFileName_);
     String extension = GetExtension(scriptFileName_);
-    if (extension != ".lua")
+    if (extension != ".lua" && extension != ".luc")
     {
     {
 #ifdef ENABLE_ANGELSCRIPT
 #ifdef ENABLE_ANGELSCRIPT
         // Instantiate and register the AngelScript subsystem
         // Instantiate and register the AngelScript subsystem