Acedayz
Member
- Joined
- Jan 24, 2015
- Messages
- 38
- Reaction score
- 19
I'm currently creating thousands of [Edit: 1,073,741,824] tiles using Game.createTile(position[, isDynamic = false]).
And these tiles will eventually no longer be needed, so I need a way to remove them to save memory.
Here is the function to create tiles:
However, there's no function that can remove tiles.
How would I go about doing this?
And these tiles will eventually no longer be needed, so I need a way to remove them to save memory.
Here is the function to create tiles:
Code:
int32_t LuaScriptInterface::luaGameCreateTile(lua_State* L)
{
// Game.createTile(x, y, z[, isDynamic = false])
// Game.createTile(position[, isDynamic = false])
Position position;
bool isDynamic;
if (isTable(L, 1)) {
position = getPosition(L, 1);
isDynamic = getBoolean(L, 2, false);
} else {
position.x = getNumber<uint16_t>(L, 1);
position.y = getNumber<uint16_t>(L, 2);
position.z = getNumber<uint16_t>(L, 3);
isDynamic = getBoolean(L, 4, false);
}
Tile* tile = g_game.getTile(position);
if (!tile) {
if (isDynamic) {
tile = new DynamicTile(position.x, position.y, position.z);
} else {
tile = new StaticTile(position.x, position.y, position.z);
}
g_game.setTile(tile);
}
pushUserdata(L, tile);
setMetatable(L, -1, "Tile");
return 1;
}
However, there's no function that can remove tiles.
How would I go about doing this?
Last edited: