LogoLogo
  • Introduction
  • sdks
    • Feature Comparison
    • Unity
    • Godot
    • Defold
    • LÖVE
    • Unreal
  • Quick Start
    • Unity
    • Godot
    • Defold
    • LÖVE
    • Unreal
  • Server Side
    • Entities
    • Chunks
    • Dimensions
    • Events
    • Logging
    • Lua Environment
    • Git Primer
    • Physics
  • HTTP API
    • Authentication
    • Player API
  • Api Reference
    • Entity API
      • Create
      • Message
    • Client API
      • Message
    • Dimension API
      • Create
      • Delete
      • List
    • Events API
      • on_player_join
      • on_player_leave
    • Table API
      • Append
      • Remove
      • Join
    • Util API
      • Time
      • TimeMillis
    • HTTP Request API
      • Get
      • Post
      • Put
      • Delete
    • Physics API
      • NewBody
      • NewBoxShape
      • NewSphereShape
Powered by GitBook
On this page
  1. Api Reference
  2. Dimension API

Create

api.dimension.Create(dimension)

Creates a new dimension. When a dimension is first loaded, a small number of chunks around the origin will be loaded.

The function will fail if there is already a dimension with the given ID. The default dimension already holds the ID of an empty string ("").

Parameters:

Name
Type
Description

dimension

string

The ID of the dimension to be created.

Example:

Create a new dimension from the origin chunk of the default dimension.

-- init.lua
function init()
    if not chunk.Generated then
        if chunk.X == 0 and chunk.Y == 0 then
        
            if chunk.Dimension == "" then
                api.dimension.Create("Catland")
            else
                api.entity.Create("cat",0,0,0,{})
                print("This chunk is in "..chunk.Dimension.." and there is a cat!")
            end
            
        end
    end
end

-- When the chunk at the origin of the default dimension loads for the first time,
-- create a dimension called Catland.
-- When the chunk at the origin of Catland loads for the first time,
-- create a cat and print.

-- Prints:
-- This chunk is in Catland and there is a cat!

PreviousDimension APINextDelete

Last updated 3 months ago