source: branches/BAR/luaui.lua @ 5877

Revision 5874, 1.8 KB checked in by Bluestone, 23 months ago (diff)

fix Game.Version vs Engine.Version

Line 
1--------------------------------------------------------------------------------
2--------------------------------------------------------------------------------
3--
4--  file:    luaui.lua
5--  brief:   entry point for LuaUI
6--  author:  Dave Rodgers
7--
8--  Copyright (C) 2008.
9--  Licensed under the terms of the GNU GPL, v2 or later.
10--
11--------------------------------------------------------------------------------
12--------------------------------------------------------------------------------
13
14LUAUI_VERSION = "LuaUI v0.3"
15LUAUI_DIRNAME = 'LuaUI/'
16VFS.DEF_MODE = VFS.RAW_FIRST
17local STARTUP_FILENAME = LUAUI_DIRNAME .. 'barmain.lua'
18
19
20--------------------------------------------------------------------------------
21--------------------------------------------------------------------------------
22
23do
24  -- use a versionned directory name if it exists
25  local sansslash = string.sub(LUAUI_DIRNAME, 1, -2)
26  local versiondir = sansslash .. '-' .. (Game.version or Engine.version) .. '/'
27  if (VFS.FileExists(versiondir  .. 'barmain.lua', VFS.ZIP)) then
28    LUAUI_DIRNAME = versiondir
29  end
30end
31
32Spring.Echo('Using LUAUI_DIRNAME = ' .. LUAUI_DIRNAME)
33
34
35--------------------------------------------------------------------------------
36--------------------------------------------------------------------------------
37--
38-- load the user's UI
39--
40
41do
42  local text = VFS.LoadFile(STARTUP_FILENAME, VFS.ZIP)
43  if (text == nil) then
44    Script.Kill('Failed to load ' .. STARTUP_FILENAME)
45  end
46  local chunk, err = loadstring(text)
47  if (chunk == nil) then
48    Script.Kill('Failed to load ' .. STARTUP_FILENAME .. ' (' .. err .. ')')
49  else
50    chunk()
51    return
52  end
53end
54
55
56--------------------------------------------------------------------------------
57--------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.