From 1b2346740c8b23f56a29bcbb646266667a911f6b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 16 May 2009 13:06:57 +0000 Subject: add Lua_GetOwner to ULuaUtils (function returns plugin by lua state) use new function in ULuaParty and ULuaUsdx new lua function: Usdx.ShutMeDown to give plugins the ability to unload git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1732 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Lua/src/lua/ULuaParty.pas | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Lua/src/lua/ULuaParty.pas') diff --git a/Lua/src/lua/ULuaParty.pas b/Lua/src/lua/ULuaParty.pas index 41a0d2ae..25cfce94 100644 --- a/Lua/src/lua/ULuaParty.pas +++ b/Lua/src/lua/ULuaParty.pas @@ -101,14 +101,13 @@ function ULuaParty_Register(L: Plua_State): Integer; cdecl; var Info: TParty_ModeInfo; Key: String; + P: TLuaPlugin; begin // check for table on stack luaL_checkType(L, 1, LUA_TTABLE); // get parent id - lua_getfield (L, LUA_REGISTRYINDEX, '_USDX_STATE_ID'); - if (not lua_isNumber(L, -1)) then - luaL_error(L, 'unable to get _USDX_STATE_ID in ULuaParty_Register'); + P := Lua_GetOwner(L); // set mode info to default @@ -116,8 +115,7 @@ begin // set parent in info rec and pop it from stack - Info.Parent := lua_toInteger(L, -1); - lua_pop(L, 1); + Info.Parent := P.Id; // go through table elements lua_pushNil(L); -- cgit v1.2.3