#include "emerge.h"
#include "pathfinder.h"
-#define GET_ENV_PTR ServerEnvironment* env = \
- dynamic_cast<ServerEnvironment*>(getEnv(L)); \
- if (env == NULL) return 0
-
///////////////////////////////////////////////////////////////////////////////
// returns world-specific PerlinNoise
int ModApiEnvMod::l_get_perlin(lua_State *L)
{
- GET_ENV_PTR;
+ GET_ENV_PTR_NO_MAP_LOCK;
NoiseParams params;
// returns world-specific PerlinNoiseMap
int ModApiEnvMod::l_get_perlin_map(lua_State *L)
{
- GET_ENV_PTR;
+ GET_ENV_PTR_NO_MAP_LOCK;
NoiseParams np;
if (!read_noiseparams(L, 1, &np))
// get_us_time()
int ModApiEnvMod::l_get_us_time(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
lua_pushnumber(L, porting::getTimeUs());
return 1;
}
#define API_FCT(name) registerFunction(L, #name, l_##name,top)
#define ASYNC_API_FCT(name) engine.registerFunction(#name, l_##name)
+#define MAP_LOCK_REQUIRED
#define NO_MAP_LOCK_REQUIRED
/*
#endif
*/
+#define GET_ENV_PTR_NO_MAP_LOCK \
+ ServerEnvironment *env = (ServerEnvironment *)getEnv(L); \
+ if (env == NULL) \
+ return 0
+
+#define GET_ENV_PTR \
+ MAP_LOCK_REQUIRED; \
+ GET_ENV_PTR_NO_MAP_LOCK
+
#endif /* L_INTERNAL_H_ */
std::string type = checkstringfield(L, 1, "type");
if(type == "node"){
+ MAP_LOCK_REQUIRED;
lua_getfield(L, 1, "pos");
v3s16 pos = check_v3s16(L, -1);
loc.setNodeMeta(pos);
InvRef::create(L, loc);
else
lua_pushnil(L);
- return 1;
+ return 1;
// END NO_MAP_LOCK_REQUIRED;
}
}
// returns the biome id used in biomemap
int ModApiMapgen::l_get_biome_id(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
const char *biome_str = lua_tostring(L, 1);
if (!biome_str)
return 0;
if (!bmgr)
return 0;
- Biome *biome = (Biome *) bmgr->getByName(biome_str);
+ Biome *biome = (Biome *)bmgr->getByName(biome_str);
if (!biome || biome->index == OBJDEF_INVALID_INDEX)
return 0;
// returns the requested object used during map generation
int ModApiMapgen::l_get_mapgen_object(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
const char *mgobjstr = lua_tostring(L, 1);
int mgobjint;
int ModApiMapgen::l_get_mapgen_params(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
MapgenParams *params = &getServer(L)->getEmergeManager()->params;
lua_newtable(L);
// set mapgen parameters
int ModApiMapgen::l_set_mapgen_params(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
if (!lua_istable(L, 1))
return 0;
// set global config values for noise parameters
int ModApiMapgen::l_set_noiseparams(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
const char *name = luaL_checkstring(L, 1);
NoiseParams np;
// get_noiseparams(name)
int ModApiMapgen::l_get_noiseparams(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
std::string name = luaL_checkstring(L, 1);
NoiseParams np;
// set_gen_notify(flags, {deco_id_table})
int ModApiMapgen::l_set_gen_notify(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
u32 flags = 0, flagmask = 0;
EmergeManager *emerge = getServer(L)->getEmergeManager();
// get_gen_notify()
int ModApiMapgen::l_get_gen_notify(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
EmergeManager *emerge = getServer(L)->getEmergeManager();
push_flags_string(L, flagdesc_gennotify, emerge->gen_notify_on,
emerge->gen_notify_on);
// register_biome({lots of stuff})
int ModApiMapgen::l_register_biome(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
int index = 1;
luaL_checktype(L, index, LUA_TTABLE);
// register_decoration({lots of stuff})
int ModApiMapgen::l_register_decoration(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
int index = 1;
luaL_checktype(L, index, LUA_TTABLE);
// register_ore({lots of stuff})
int ModApiMapgen::l_register_ore(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
int index = 1;
luaL_checktype(L, index, LUA_TTABLE);
// register_schematic({schematic}, replacements={})
int ModApiMapgen::l_register_schematic(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr;
StringMap replace_names;
// clear_registered_biomes()
int ModApiMapgen::l_clear_registered_biomes(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
bmgr->clear();
return 0;
// clear_registered_decorations()
int ModApiMapgen::l_clear_registered_decorations(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
DecorationManager *dmgr = getServer(L)->getEmergeManager()->decomgr;
dmgr->clear();
return 0;
// clear_registered_ores()
int ModApiMapgen::l_clear_registered_ores(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
OreManager *omgr = getServer(L)->getEmergeManager()->oremgr;
omgr->clear();
return 0;
// clear_registered_schematics()
int ModApiMapgen::l_clear_registered_schematics(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
SchematicManager *smgr = getServer(L)->getEmergeManager()->schemmgr;
smgr->clear();
return 0;
// generate_ores(vm, p1, p2, [ore_id])
int ModApiMapgen::l_generate_ores(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
EmergeManager *emerge = getServer(L)->getEmergeManager();
Mapgen mg;
// generate_decorations(vm, p1, p2, [deco_id])
int ModApiMapgen::l_generate_decorations(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
EmergeManager *emerge = getServer(L)->getEmergeManager();
Mapgen mg;
// create_schematic(p1, p2, probability_list, filename, y_slice_prob_list)
int ModApiMapgen::l_create_schematic(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
INodeDefManager *ndef = getServer(L)->getNodeDefManager();
const char *filename = luaL_checkstring(L, 4);
// place_schematic(p, schematic, rotation, replacement)
int ModApiMapgen::l_place_schematic(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
Map *map = &(getEnv(L)->getMap());
SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr;
// serialize_schematic(schematic, format, options={...})
int ModApiMapgen::l_serialize_schematic(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr;
//// Read options
// get_string(self, name)
int NodeMetaRef::l_get_string(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
std::string name = luaL_checkstring(L, 2);
// set_string(self, name, var)
int NodeMetaRef::l_set_string(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
std::string name = luaL_checkstring(L, 2);
size_t len = 0;
// get_int(self, name)
int NodeMetaRef::l_get_int(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
std::string name = lua_tostring(L, 2);
// set_int(self, name, var)
int NodeMetaRef::l_set_int(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
std::string name = lua_tostring(L, 2);
int a = lua_tointeger(L, 3);
// get_float(self, name)
int NodeMetaRef::l_get_float(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
std::string name = lua_tostring(L, 2);
// set_float(self, name, var)
int NodeMetaRef::l_set_float(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
std::string name = lua_tostring(L, 2);
float a = lua_tonumber(L, 3);
// get_inventory(self)
int NodeMetaRef::l_get_inventory(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
getmeta(ref, true); // try to ensure the metadata exists
InvRef::createNodeMeta(L, ref->m_p);
// to_table(self)
int NodeMetaRef::l_to_table(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
NodeMetadata *meta = getmeta(ref, true);
// from_table(self, table)
int NodeMetaRef::l_from_table(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
int base = 2;
int NodeTimerRef::l_set(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
NodeTimerRef *o = checkobject(L, 1);
ServerEnvironment *env = o->m_env;
if(env == NULL) return 0;
int NodeTimerRef::l_start(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
NodeTimerRef *o = checkobject(L, 1);
ServerEnvironment *env = o->m_env;
if(env == NULL) return 0;
int NodeTimerRef::l_stop(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
NodeTimerRef *o = checkobject(L, 1);
ServerEnvironment *env = o->m_env;
if(env == NULL) return 0;
int NodeTimerRef::l_is_started(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
NodeTimerRef *o = checkobject(L, 1);
ServerEnvironment *env = o->m_env;
if(env == NULL) return 0;
int NodeTimerRef::l_get_timeout(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
NodeTimerRef *o = checkobject(L, 1);
ServerEnvironment *env = o->m_env;
if(env == NULL) return 0;
int NodeTimerRef::l_get_elapsed(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
NodeTimerRef *o = checkobject(L, 1);
ServerEnvironment *env = o->m_env;
if(env == NULL) return 0;
int LuaPseudoRandom::l_next(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
+
LuaPseudoRandom *o = checkobject(L, 1);
int min = 0;
int max = 32767;
int LuaPseudoRandom::create_object(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
int seed = luaL_checknumber(L, 1);
LuaPseudoRandom *o = new LuaPseudoRandom(seed);
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;
int LuaPcgRandom::create_object(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
lua_Integer seed = luaL_checknumber(L, 1);
LuaPcgRandom *o = lua_isnumber(L, 2) ?
new LuaPcgRandom(seed, lua_tointeger(L, 2)) :
#include "hud.h"
#include "scripting_game.h"
-#define GET_ENV_PTR ServerEnvironment* env = \
- dynamic_cast<ServerEnvironment*>(getEnv(L)); \
- if (env == NULL) return 0
-
struct EnumString es_HudElementType[] =
{
{HUD_ELEM_IMAGE, "image"},
// remove(self)
int ObjectRef::l_remove(lua_State *L)
{
- NO_MAP_LOCK_REQUIRED;
GET_ENV_PTR;
ObjectRef *ref = checkobject(L, 1);
// physics_override_gravity, sneak, sneak_glitch)
int ObjectRef::l_set_physics_override(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
PlayerSAO *co = (PlayerSAO *) getobject(ref);
if (co == NULL) return 0;
// get_physics_override(self)
int ObjectRef::l_get_physics_override(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
PlayerSAO *co = (PlayerSAO *)getobject(ref);
if (co == NULL)
// set_local_animation(self, {stand/idle}, {walk}, {dig}, {walk+dig}, frame_speed)
int ObjectRef::l_set_local_animation(lua_State *L)
{
- //NO_MAP_LOCK_REQUIRED;
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// get_local_animation(self)
int ObjectRef::l_get_local_animation(lua_State *L)
{
- //NO_MAP_LOCK_REQUIRED
+ NO_MAP_LOCK_REQUIRED
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// set_eye_offset(self, v3f first pv, v3f third pv)
int ObjectRef::l_set_eye_offset(lua_State *L)
{
- //NO_MAP_LOCK_REQUIRED;
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// get_eye_offset(self)
int ObjectRef::l_get_eye_offset(lua_State *L)
{
- //NO_MAP_LOCK_REQUIRED;
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// set_attach(self, parent, bone, position, rotation)
int ObjectRef::l_set_attach(lua_State *L)
{
- NO_MAP_LOCK_REQUIRED;
GET_ENV_PTR;
ObjectRef *ref = checkobject(L, 1);
// get_attach(self)
int ObjectRef::l_get_attach(lua_State *L)
{
- NO_MAP_LOCK_REQUIRED;
GET_ENV_PTR;
ObjectRef *ref = checkobject(L, 1);
// set_detach(self)
int ObjectRef::l_set_detach(lua_State *L)
{
- NO_MAP_LOCK_REQUIRED;
GET_ENV_PTR;
ObjectRef *ref = checkobject(L, 1);
// hud_add(self, form)
int ObjectRef::l_hud_add(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// hud_remove(self, id)
int ObjectRef::l_hud_remove(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// hud_change(self, id, stat, data)
int ObjectRef::l_hud_change(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// hud_get(self, id)
int ObjectRef::l_hud_get(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// hud_set_flags(self, flags)
int ObjectRef::l_hud_set_flags(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
int ObjectRef::l_hud_get_flags(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// hud_set_hotbar_itemcount(self, hotbar_itemcount)
int ObjectRef::l_hud_set_hotbar_itemcount(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// hud_get_hotbar_itemcount(self)
int ObjectRef::l_hud_get_hotbar_itemcount(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// hud_set_hotbar_image(self, name)
int ObjectRef::l_hud_set_hotbar_image(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// hud_get_hotbar_image(self)
int ObjectRef::l_hud_get_hotbar_image(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// hud_set_hotbar_selected_image(self, name)
int ObjectRef::l_hud_set_hotbar_selected_image(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// hud_get_hotbar_selected_image(self)
int ObjectRef::l_hud_get_hotbar_selected_image(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// set_sky(self, bgcolor, type, list)
int ObjectRef::l_set_sky(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// get_sky(self)
int ObjectRef::l_get_sky(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// override_day_night_ratio(self, brightness=0...1)
int ObjectRef::l_override_day_night_ratio(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// get_day_night_ratio(self)
int ObjectRef::l_get_day_night_ratio(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
// texture = e.g."default_wood.png"
int ModApiParticles::l_add_particle(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
// Get parameters
v3f pos, vel, acc;
pos = vel = acc = v3f(0, 0, 0);
// texture = e.g."default_wood.png"
int ModApiParticles::l_add_particlespawner(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
// Get parameters
u16 amount = 1;
v3f minpos, maxpos, minvel, maxvel, minacc, maxacc;
// player (string) is optional
int ModApiParticles::l_delete_particlespawner(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
// Get parameters
u32 id = luaL_checknumber(L, 1);
std::string playername = "";
// rollback_get_node_actions(pos, range, seconds, limit) -> {{actor, pos, time, oldnode, newnode}, ...}
int ModApiRollback::l_rollback_get_node_actions(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
v3s16 pos = read_v3s16(L, 1);
int range = luaL_checknumber(L, 2);
time_t seconds = (time_t) luaL_checknumber(L, 3);
// rollback_revert_actions_by(actor, seconds) -> bool, log messages
int ModApiRollback::l_rollback_revert_actions_by(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
std::string actor = luaL_checkstring(L, 1);
int seconds = luaL_checknumber(L, 2);
Server *server = getServer(L);
// request_shutdown()
int ModApiServer::l_request_shutdown(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
const char *msg = lua_tolstring(L, 1, NULL);
bool reconnect = lua_toboolean(L, 2);
getServer(L)->requestShutdown(msg ? msg : "", reconnect);
int ModApiUtil::l_get_builtin_path(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
std::string path = porting::path_share + DIR_DELIM + "builtin";
lua_pushstring(L, path.c_str());
return 1;
// compress(data, method, level)
int ModApiUtil::l_compress(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
size_t size;
const char *data = luaL_checklstring(L, 1, &size);
// decompress(data, method)
int ModApiUtil::l_decompress(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
size_t size;
const char *data = luaL_checklstring(L, 1, &size);
#include "server.h"
#include "mapgen.h"
-#define GET_ENV_PTR ServerEnvironment* env = \
- dynamic_cast<ServerEnvironment*>(getEnv(L)); \
- if (env == NULL) return 0
-
// garbage collector
int LuaVoxelManip::gc_object(lua_State *L)
{
int LuaVoxelManip::l_read_from_map(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
LuaVoxelManip *o = checkobject(L, 1);
MMVManip *vm = o->vm;
int LuaVoxelManip::l_write_to_map(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
LuaVoxelManip *o = checkobject(L, 1);
MMVManip *vm = o->vm;
int LuaVoxelManip::l_get_node_at(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
- GET_ENV_PTR;
+
+ INodeDefManager *ndef = getServer(L)->getNodeDefManager();
LuaVoxelManip *o = checkobject(L, 1);
v3s16 pos = check_v3s16(L, 2);
- pushnode(L, o->vm->getNodeNoExNoEmerge(pos), env->getGameDef()->ndef());
+ pushnode(L, o->vm->getNodeNoExNoEmerge(pos), ndef);
return 1;
}
int LuaVoxelManip::l_set_node_at(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
- GET_ENV_PTR;
+
+ INodeDefManager *ndef = getServer(L)->getNodeDefManager();
LuaVoxelManip *o = checkobject(L, 1);
v3s16 pos = check_v3s16(L, 2);
- MapNode n = readnode(L, 3, env->getGameDef()->ndef());
+ MapNode n = readnode(L, 3, ndef);
o->vm->setNodeNoEmerge(pos, n);
int LuaVoxelManip::l_update_map(lua_State *L)
{
+ GET_ENV_PTR;
+
LuaVoxelManip *o = checkobject(L, 1);
if (o->is_mapgen_vm)
return 0;
- Environment *env = getEnv(L);
- if (!env)
- return 0;
-
Map *map = &(env->getMap());
// TODO: Optimize this by using Mapgen::calcLighting() instead
int LuaVoxelManip::l_get_emerged_area(lua_State *L)
{
+ NO_MAP_LOCK_REQUIRED;
+
LuaVoxelManip *o = checkobject(L, 1);
push_v3s16(L, o->vm->m_area.MinEdge);
// Creates an LuaVoxelManip and leaves it on top of stack
int LuaVoxelManip::create_object(lua_State *L)
{
- NO_MAP_LOCK_REQUIRED;
-
- Environment *env = getEnv(L);
- if (!env)
- return 0;
+ GET_ENV_PTR;
Map *map = &(env->getMap());
LuaVoxelManip *o = (lua_istable(L, 1) && lua_istable(L, 2)) ?