1. switch (mgobj) {
  2. case MGOBJ_VMANIP: {
  3. ManualMapVoxelManipulator *vm = mg->vm;
  4. // VoxelManip object
  5. *(void **)(lua_newuserdata(L, sizeof(void *))) = vm;
  6. luaL_getmetatable(L, "VoxelManip");
  7. lua_setmetatable(L, -2);
  8. lua_pushliteral(L, "__gc");
  9. lua_pushcfunction(L, NULL);
  10. lua_setmetatable(L, -1);
  11. // VoxelManip data
  12. int volume = vm->m_area.getVolume();
  13. lua_newtable(L);
  14. for (int i = 0; i != volume; i++) {
  15. lua_Number cid = vm->m_data[i].getContent();
  16. lua_pushnumber(L, cid);
  17. lua_rawseti(L, -2, i + 1);
  18. }
  19. // emerged min pos
  20. push_v3s16(L, vm->m_area.MinEdge);
  21. // emerged max pos
  22. push_v3s16(L, vm->m_area.MaxEdge);
  23. nargs = 4;
  24. break; }
Comments powered by Disqus