소스 검색

Sort things more reliably;

bjorn 7 년 전
부모
커밋
baea1dbfbd
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      api/main.lua

+ 10 - 0
api/main.lua

@@ -169,6 +169,8 @@ local function processObject(path, parent)
     end
   end
 
+  table.sort(object.methods, function(a, b) return a.key < b.key end)
+
   return object
 end
 
@@ -209,6 +211,10 @@ local function processModule(path)
     end
   end
 
+  table.sort(module.functions, function(a, b) return a.key < b.key end)
+  table.sort(module.objects, function(a, b) return a.key < b.key end)
+  table.sort(module.enums, function(a, b) return a.key < b.key end)
+
   return module
 end
 
@@ -235,6 +241,10 @@ function lovr.load()
     table.insert(api.callbacks, processFunction(callbacks .. '/' .. file:gsub('%.lua', ''), api.modules[1]))
   end
 
+  -- Sort
+  table.sort(api.modules, function(a, b) return a.key < b.key end)
+  table.sort(api.callbacks, function(a, b) return a.key < b.key end)
+
   -- Serialize
   local file = io.open(lovr.filesystem.getSource() .. '/init.lua', 'w')
   assert(file, 'Could not open init.lua for writing')