Lua functions
Game
Available methods:
Game.broadcastMessage(message, messageType)
Description: Send message to all players Parameters: Returns: Nothing Example:
Added in version: 1.0
Game.convertIpToString(ip)
Description: Convert numeric representation of IPv4 to string with dot separated octets Parameters: Returns: String Example:
Added in version: 1.0
Game.createItem(itemId, count[, position])
Description: Creates an item. Parameters: Returns: The item created. (userdata) Example:
Added in version: 1.0
Game.createContainer(itemId, size[, position])
Description: Creates a container with given size. Parameters: Returns: The container created. (userdata) Example:
Added in version: 1.1
Game.createMonster(monsterName, position[, extended = false[, force = false]])
Description: Creates a monster. Parameters: Returns: The monster created. (userdata) Example:
Added in version: 1.0
Game.createNpc(npcName, position[, extended = false[, force = false]])
Description: Creates a npc. Parameters: Returns: The npc created. (userdata) Example:
Added in version: 1.0
Game.createTile(x, y, z[, isDynamic = false])
Description: Creates a tile if it can. Parameters: Returns: The tile created or the previous existing one. (userdata) Example:
Added in version: 1.0
Game.createTile(position[, isDynamic = false])
Description: Creates a tile if it can. Parameters: Returns: The tile created or the previous existing one. (userdata) Example:
Added in version: 1.0
Game.getExperienceStage(level)
Description: Find the experience rate related to a certain level. Parameters: Returns: The experience rate related to the specified level. Example:
Added in version: 1.0
Game.getGameState()
Description: Gets the current gamestate. Parameters: None Returns: Current gamestate on the server. Example:
Added in version: 1.0
Game.getHouses()
Description: Get all houses. Parameters: None Returns: A table containing all houses (userdata). Example:
Added in version: 1.0
Game.getMonsterCount()
Description: Find the total amount of monsters on the server. Parameters: None Returns: Total amount of monsters on the server. Example:
Added in version: 1.0
Game.getNpcCount()
Description: Find the total amount of npcs on the server. Parameters: None Returns: Total amount of npcs on the server. Example:
Added in version: 1.0
Game.getPlayerCount()
Description: Find the total amount of players on the server. Parameters: None Returns: Total amount of players on the server. Example:
Added in version: 1.0
Game.getPlayers()
Description: Get all connected players. Parameters: None Returns: A table containing all connected players (userdata). Example:
Added in version: 1.0
Game.getReturnMessage(value)
Description: Gets a message associated with the value. Parameters: Returns: true Example:
Added in version: 1.0
Game.getReverseDirection(direction)
Description: Gets reversed direction. Parameters: Returns: Direction (integer) Example:
Added in version: 1.0
Game.getSkillType(weaponType)
Description: Gets skill type associatet with weapon type. Parameters: Returns: Skill type (integer) Example:
Added in version: 1.0
Game.getSpectators(position[, multifloor = false[, onlyPlayer = false[, minRangeX = 0[, maxRangeX = 0[, minRangeY = 0[, maxRangeY = 0]]]]]])
Description: Get all creatures in the area. Parameters: Returns: A table containing creatures found (userdata). Example:
Added in version: 1.0
Game.getStorageValue(key)
Description: Get value from globalStorageTable Parameters: Returns: Value from table on empty index nil value Example:
Added in version: 1.0
Game.getTowns()
Description: Get all towns. Parameters: None Returns: A table containing all towns (userdata). Example:
Added in version: 1.0
Game.getWorldType()
Description: Gets the current world type. Parameters: None Returns: Current gamestate on the server. Example:
Added in version: 1.0
Game.loadMap(path)
Description: This loads a new map chunk. Parameters: Returns: Nothing Example:
Added in version: 1.0
Game.setGameState(state)
Description: Sets the current gamestate. Parameters: Returns: true Example:
Added in version: 1.0
Game.setStorageValue(key, value)
Description: Insert value into globalStorageTable on specific key Parameters: Returns: Nothing Example:
Added in version: 1.0
Game.setWorldType(type)
Description: Sets the current world type. Parameters: Returns: true Example:
Added in version: 1.0
Game.startRaid(raidName)
Description: Starts a raid if one with said name exist. Parameters: Returns: true if the raid started, nil otherwise. Example:
Added in version: 1.0
Global
Available methods:
addEvent(callback, delay, ...) stopEvent(eventid)
addEvent(callback, delay, ...)
Description: This function is used to run other functions at a later time. Parameters: Returns: The id associated with this event. Example:
Added in version: 1.0
stopEvent(eventid)
Description: This function is used to stop functions that should run later. Parameters: Returns: true if an event was stopped, false otherwise. Example:
Added in version: 1.0
os
Available methods:
os.mtime()
Description: Returns the Unix time (epoch) in milliseconds Parameters: None Returns: The Unix time (epoch) in milliseconds Example:
Added in version: 1.0
table
Available methods:
create(arrayLength, keyLength)
table.create(arrayLength, keyLength)
Description: Creates a new table with specified length. Parameters: Returns: The created table. Example:
Added in version: 1.0
Last updated