From eab0940bcf7577a9542b474848ee376c581d898c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 20 Apr 2009 12:47:39 +0000 Subject: hookable event nearly finished(unhook function missing) plugin Id now written to the lua states registry Usdx.Version added, Usdx.Hook added git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1689 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Lua/src/lua/ULuaCore.pas | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Lua/src/lua/ULuaCore.pas') diff --git a/Lua/src/lua/ULuaCore.pas b/Lua/src/lua/ULuaCore.pas index 9f965567..403709dd 100644 --- a/Lua/src/lua/ULuaCore.pas +++ b/Lua/src/lua/ULuaCore.pas @@ -655,7 +655,12 @@ begin lua_checkstack(State, 2); lua_pushinteger(State, Id); lua_pushcclosure(State, TLuaPlugin_Register, 1); - lua_setglobal(State, PChar('register')); + lua_setglobal(State, PChar('register')); + + // write plugin id to registry + lua_pushinteger(State, iId); + lua_setfield (State, LUA_REGISTRYINDEX, '_USDX_STATE_ID'); + lua_pop(State, Lua_GetTop(State)); // now run the plugin_init function // plugin_init() if false or nothing is returned plugin init is aborted -- cgit v1.2.3