From 30648d1cc987b25ccd2e09e18ee483a6b92e5ec1 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 28 Nov 2011 01:11:17 +0200 Subject: Implement callback registration in Lua instead of C --- src/scriptapi.cpp | 80 ------------------------------------------------------- 1 file changed, 80 deletions(-) (limited to 'src') diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp index 1872085dc..fb1b58f5d 100644 --- a/src/scriptapi.cpp +++ b/src/scriptapi.cpp @@ -837,79 +837,6 @@ static int l_register_craft(lua_State *L) return 0; /* number of results */ } -static int register_lua_callback(lua_State *L, const char *tablename) -{ - luaL_checktype(L, 1, LUA_TFUNCTION); - - lua_getglobal(L, "table"); - lua_getfield(L, -1, "insert"); - int table_insert = lua_gettop(L); - // Get minetest.registered_globalsteps - lua_getglobal(L, "minetest"); - lua_getfield(L, -1, tablename); - luaL_checktype(L, -1, LUA_TTABLE); - int registered = lua_gettop(L); - // table.insert(registered_globalsteps, func) - lua_pushvalue(L, table_insert); - lua_pushvalue(L, registered); - lua_pushvalue(L, 1); // push function from argument 1 - // Call insert - if(lua_pcall(L, 2, 0, 0)) - script_error(L, "error: %s\n", lua_tostring(L, -1)); - - return 0; /* number of results */ -} - -// Register a global step function -// register_globalstep(function) -static int l_register_globalstep(lua_State *L) -{ - infostream<<"register_globalstep"<