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