aboutsummaryrefslogtreecommitdiffstats
path: root/Lua/src/base/UMain.pas
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-04 07:29:52 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-04 07:29:52 +0000
commit14e96597c65a2402ee4ddc068ff08c7659123a1d (patch)
treeebefcbd5ec72570f68bb7b043365b3d6fb93dd6b /Lua/src/base/UMain.pas
parent2449e4a979c23addcc9110a4dc876d9acd761005 (diff)
downloadusdx-14e96597c65a2402ee4ddc068ff08c7659123a1d.tar.gz
usdx-14e96597c65a2402ee4ddc068ff08c7659123a1d.tar.xz
usdx-14e96597c65a2402ee4ddc068ff08c7659123a1d.zip
old lua test stuff by hawkear removed or commented
new function: Party.SetWinner sets winner of current round new unit ULuaUtils w/ some functions that are or may become useful moved Lua_ClearStack and Lua_ToBinInt to ULuaUtils added first hooks (have a look at hooks.txt in game/plugins until documentation is finished) lua module for TextGl written and finished lua testfile (game/scripts/main.lua) ported to new interface, see game/plugins/LuaTest.usdx git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1709 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Lua/src/base/UMain.pas20
1 files changed, 11 insertions, 9 deletions
diff --git a/Lua/src/base/UMain.pas b/Lua/src/base/UMain.pas
index 57ad01a1..a1c77900 100644
--- a/Lua/src/base/UMain.pas
+++ b/Lua/src/base/UMain.pas
@@ -118,7 +118,7 @@ var
PlayersPlay: integer;
CurrentSong : TSong;
- Lua : Plua_State;
+ //Lua : Plua_State;
const
MAX_SONG_SCORE = 10000; // max. achievable points per song
@@ -228,6 +228,9 @@ begin
SDL_Init(SDL_INIT_VIDEO or SDL_INIT_TIMER);
SDL_EnableUnicode(1);
+ // create luacore first so other classes can register their events
+ LuaCore := TLuaCore.Create;
+
USTime := TTime.Create;
VideoBGTimer := TRelativeTimer.Create;
@@ -390,7 +393,7 @@ begin
end;
// Lua
- Log.BenchmarkStart(1);
+ {Log.BenchmarkStart(1);
Lua := luaL_newstate;
if Lua = nil then
Log.LogError('Lua init failed','Lua');
@@ -403,7 +406,7 @@ begin
luaopen_TextGL(Lua); // TextGL (Lua)
lua_pop(Lua, 1); // remove table from stack
luaopen_Texture(Lua); // Texture (Lua)
- lua_pop(Lua, 1); // remove table from stack
+ lua_pop(Lua, 1); // remove table from stack }
Log.BenchmarkEnd(1);
Log.LogBenchmark('Initializing Lua', 1);
@@ -422,13 +425,12 @@ begin
Party := TPartyGame.Create;
- LuaCore := TLuaCore.Create;
-
LuaCore.RegisterModule('Log', ULuaLog_Lib_f);
LuaCore.RegisterModule('Gl', ULuaGl_Lib_f);
+ LuaCore.RegisterModule('TextGl', ULuaTextGl_Lib_f);
LuaCore.RegisterModule('Party', ULuaParty_Lib_f);
- LuaCore.BrowseDir(PluginPath);
+ LuaCore.LoadPlugins;
LuaCore.DumpPlugins;
@@ -454,7 +456,7 @@ begin
//TTF_Quit();
SDL_Quit();
- lua_close(Lua);
+ //lua_close(Lua);
if assigned(Log) then
begin
@@ -487,14 +489,14 @@ begin
// display
done := not Display.Draw;
- // FIXME remove this when the Partymode works
+ {// FIXME remove this when the Partymode works
if FileExists(ScriptPath + 'main.lua') then
begin
if 0 <> luaL_dofile(Lua, PAnsiChar(ScriptPath + 'main.lua')) then
begin
Log.LogError(lua_tostring(Lua,-1));
end;
- end;
+ end; }
SwapBuffers;