aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
ModeNameSize
-rw-r--r--CMakeLists.txt1203logplain
-rw-r--r--l_areastore.cpp9072logplain
-rw-r--r--l_areastore.h1818logplain
-rw-r--r--l_base.cpp2208logplain
-rw-r--r--l_base.h2108logplain
-rw-r--r--l_client.cpp4609logplain
-rw-r--r--l_client.h1814logplain
-rw-r--r--l_craft.cpp14132logplain
-rw-r--r--l_craft.h1633logplain
-rw-r--r--l_env.cpp27948logplain
-rw-r--r--l_env.h6939logplain
-rw-r--r--l_http.cpp5682logplain
-rw-r--r--l_http.h1533logplain
-rw-r--r--l_internal.h1997logplain
-rw-r--r--l_inventory.cpp13558logplain
-rw-r--r--l_inventory.h3776logplain
-rw-r--r--l_item.cpp16115logplain
-rw-r--r--l_item.h4477logplain
-rw-r--r--l_itemstackmeta.cpp3212logplain
-rw-r--r--l_itemstackmeta.h1686logplain
-rw-r--r--l_mainmenu.cpp30332logplain
-rw-r--r--l_mainmenu.h3882logplain
-rw-r--r--l_mapgen.cpp38949logplain
-rw-r--r--l_mapgen.h3897logplain
-rw-r--r--l_metadata.cpp5847logplain
-rw-r--r--l_metadata.h1917logplain
-rw-r--r--l_minimap.cpp4767logplain
-rw-r--r--l_minimap.h1673logplain
-rw-r--r--l_nodemeta.cpp5623logplain
-rw-r--r--l_nodemeta.h2638logplain
-rw-r--r--l_nodetimer.cpp4461logplain
-rw-r--r--l_nodetimer.h1773logplain
-rw-r--r--l_noise.cpp15532logplain
-rw-r--r--l_noise.h4590logplain
-rw-r--r--l_object.cpp47812logplain
-rw-r--r--l_object.h8807logplain
-rw-r--r--l_particles.cpp8429logplain
-rw-r--r--l_particles.h1148logplain
-rw-r--r--l_rollback.cpp3552logplain
-rw-r--r--l_rollback.h1278logplain
-rw-r--r--l_server.cpp14014logplain
-rw-r--r--l_server.h2976logplain
-rw-r--r--l_settings.cpp5569logplain
-rw-r--r--l_settings.h1911logplain
-rw-r--r--l_sound.cpp1752logplain
-rw-r--r--l_sound.h1118logplain
-rw-r--r--l_storage.cpp3704logplain
-rw-r--r--l_storage.h1701logplain
-rw-r--r--l_util.cpp13502logplain
-rw-r--r--l_util.h3180logplain
-rw-r--r--l_vmanip.cpp10510logplain
-rw-r--r--l_vmanip.h2274logplain
n class="hl opt">)->getBanDescription(std::string(ip_or_name)).c_str()); return 1; } // ban_player() int ModApiServer::l_ban_player(lua_State *L) { NO_MAP_LOCK_REQUIRED; const char * name = luaL_checkstring(L, 1); Player *player = getEnv(L)->getPlayer(name); if(player == NULL) { lua_pushboolean(L, false); // no such player return 1; } try { Address addr = getServer(L)->getPeerAddress(getEnv(L)->getPlayer(name)->peer_id); std::string ip_str = addr.serializeString(); getServer(L)->setIpBanned(ip_str, name); } catch(con::PeerNotFoundException) // unlikely { dstream << __FUNCTION_NAME << ": peer was not found" << std::endl; lua_pushboolean(L, false); // error return 1; } lua_pushboolean(L, true); return 1; } // kick_player(name, [reason]) -> success int ModApiServer::l_kick_player(lua_State *L) { NO_MAP_LOCK_REQUIRED; const char *name = luaL_checkstring(L, 1); std::string message; if (lua_isstring(L, 2)) { message = std::string("Kicked: ") + lua_tostring(L, 2); } else { message = "Kicked."; } Player *player = getEnv(L)->getPlayer(name); if (player == NULL) { lua_pushboolean(L, false); // No such player return 1; } getServer(L)->DenyAccess(player->peer_id, narrow_to_wide(message)); lua_pushboolean(L, true); return 1; } // unban_player_or_ip() int ModApiServer::l_unban_player_or_ip(lua_State *L) { NO_MAP_LOCK_REQUIRED; const char * ip_or_name = luaL_checkstring(L, 1); getServer(L)->unsetIpBanned(ip_or_name); lua_pushboolean(L, true); return 1; } // show_formspec(playername,formname,formspec) int ModApiServer::l_show_formspec(lua_State *L) { NO_MAP_LOCK_REQUIRED; const char *playername = luaL_checkstring(L, 1); const char *formname = luaL_checkstring(L, 2); const char *formspec = luaL_checkstring(L, 3); if(getServer(L)->showFormspec(playername,formspec,formname)) { lua_pushboolean(L, true); }else{ lua_pushboolean(L, false); } return 1; } // get_current_modname() int ModApiServer::l_get_current_modname(lua_State *L) { NO_MAP_LOCK_REQUIRED; lua_getfield(L, LUA_REGISTRYINDEX, "minetest_current_modname"); return 1; } // get_modpath(modname) int ModApiServer::l_get_modpath(lua_State *L) { NO_MAP_LOCK_REQUIRED; std::string modname = luaL_checkstring(L, 1); // Do it if(modname == "__builtin"){ std::string path = getServer(L)->getBuiltinLuaPath(); lua_pushstring(L, path.c_str()); return 1; } const ModSpec *mod = getServer(L)->getModSpec(modname); if(!mod){ lua_pushnil(L); return 1; } lua_pushstring(L, mod->path.c_str()); return 1; } // get_modnames() // the returned list is sorted alphabetically for you int ModApiServer::l_get_modnames(lua_State *L) { NO_MAP_LOCK_REQUIRED; // Get a list of mods std::list<std::string> mods_unsorted, mods_sorted; getServer(L)->getModNames(mods_unsorted); // Take unsorted items from mods_unsorted and sort them into // mods_sorted; not great performance but the number of mods on a