|
| 1 | +-------------------------------------------------------------------------------- |
| 2 | +-------------------------------------------------------------------------------- |
| 3 | +-- |
| 4 | +-- file: main.lua |
| 5 | +-- brief: the entry point from LuaUI |
| 6 | +-- author: jK |
| 7 | +-- |
| 8 | +-- Copyright (C) 2011-2013. |
| 9 | +-- Licensed under the terms of the GNU GPL, v2 or later. |
| 10 | +-- |
| 11 | +-------------------------------------------------------------------------------- |
| 12 | +-------------------------------------------------------------------------------- |
| 13 | + |
| 14 | +LUA_NAME = Script.GetName() |
| 15 | +LUA_DIRNAME = Script.GetName() .. "/" |
| 16 | +LUA_VERSION = Script.GetName() .. " v1.0" |
| 17 | + |
| 18 | +_G[("%s_DIRNAME"):format(LUA_NAME:upper())] = LUA_DIRNAME -- creates LUAUI_DIRNAME |
| 19 | +_G[("%s_VERSION"):format(LUA_NAME:upper())] = LUA_VERSION -- creates LUAUI_VERSION |
| 20 | + |
| 21 | +VFS.DEF_MODE = VFS.RAW_FIRST |
| 22 | + |
| 23 | + |
| 24 | +------------------------------------------------------------------------------- |
| 25 | +------------------------------------------------------------------------------- |
| 26 | +-- |
| 27 | +-- Initialize the Lua LogSection (else messages with level "info" wouldn't been shown) |
| 28 | +-- |
| 29 | + |
| 30 | +if Spring.SetLogSectionFilterLevel then |
| 31 | + Spring.SetLogSectionFilterLevel(LUA_NAME, "info") |
| 32 | +else |
| 33 | + -- backward compatibility |
| 34 | + local origSpringLog = Spring.Log |
| 35 | + |
| 36 | + Spring.Log = function(name, level, ...) |
| 37 | + if (type(level) == "string")and(level == "info") then |
| 38 | + Spring.Echo(("[%s]"):format(name), ...) |
| 39 | + else |
| 40 | + origSpringLog(name, level, ...) |
| 41 | + end |
| 42 | + end |
| 43 | +end |
| 44 | + |
| 45 | + |
| 46 | +------------------------------------------------------------------------------- |
| 47 | +------------------------------------------------------------------------------- |
| 48 | +-- |
| 49 | +-- Load |
| 50 | +-- |
| 51 | + |
| 52 | +VFS.Include("LuaHandler/Utilities/utils.lua", nil, VFS.DEF_MODE) |
| 53 | + |
| 54 | +--// the addon handler |
| 55 | +include "LuaHandler/handler.lua" |
| 56 | + |
| 57 | +--// print Lua & LuaUI version |
| 58 | +Spring.Log(LUA_NAME, "info", LUA_VERSION .. " (" .. _VERSION .. ")") |
| 59 | + |
| 60 | +------------------------------------------------------------------------------- |
| 61 | +------------------------------------------------------------------------------- |
| 62 | + |
| 63 | +include "springconfig.lua" |
0 commit comments