List of Lua Functions/revscriptsys
From OpenTibia Fans
- This function list applies only to revscriptsys, for the standard function list. See List of Lua Functions.
A list of all functions available in OT.
Contents |
Built-in Functions
For undocumented functions look at the builtin lua function list.
String Functions
- string.byte(string s [, int i [, int j] ] )
- string.char(...)
- string.dump(function f)
- string.find(string s, string pattern [, init [, plain] ] )
- string.format(string format, ...)
- string.gmatch(string s, string pattern)
- string.gsub(string s, string pattern, mixed replacement [, int n] )
- string.len(string s)
- string.lower(string s)
- string.match(string s, string pattern [, int n] ))
- string.rep(string s, int n)
- string.reverse(string s)
- string.sub(string s, int i [, int j] ))
- string.upper(string s)
Table Functions
- table.append(table t, mixed value)
- table.concat(table t [, string seperator [, int i [, int j] ] ] )
- table.empty(table)
- table.find(table t, mixed value)
- table.findf(table t, mixed value[, function comparator])
- table.insert(table t, [int pos], mixed value)
- table.maxn(table t)
- table.remove(table t [, int pos] )
- table.serialize(table t)
- table.sort(table t [, function comparator] )
- table.unserialize(table t)
Coroutine Functions
- coroutine.create(function f)
- coroutine.resume(coroutine co, ...)
- coroutine.running()
- coroutine.status(coroutine co)
- coroutine.wrap(function f)
- coroutine.yield(...)
Math Functions
- math.abs(float x)
- math.acos(float x)
- math.asin(float x)
- math.atan(float x)
- math.atan2(float y, float x)
- math.ceil(float x)
- math.cos(float x)
- math.cosh(float x)
- math.deg(float x)
- math.exp(float x)
- math.floor(float x)
- math.fmod(float x, float y)
- math.frexp(float x)
- math.ldexp(float m, float e)
- math.log(float x)
- math.log10(float x)
- math.max(float x, ...)
- math.min(float x, ...)
- math.modf(float x)
- math.pow(float x, float y)
- math.rad(float x)
- math.random([float from [, float to] )
- math.randomseed(float x)
- math.sin(float x)
- math.sinh(float x)
- math.sqrt(float x)
- math.tan(float x)
- math.tanh(float x)
IO Functions
- io.close( [file f] )
- io.flush()
- io.input( [file f] )
- io.lines( [string filename])
- io.open(string filename [, string mode] )
- io.output([file f] )
- io.popen(string prog [, string mode] )
- io.read(...)
- io.tmpfile()
- io.type(file f)
- io.write(...)
- file.close()
- file.flush()
- file.lines()
- file.read(...)
- file.seek([string mode] [, int offset] )
- file.setvbuf(string mode [, int size] )
- file.write(...)
OS functions
- os.clock()
- os.date([string format [, int time] ] )
- os.difftime(int t2, int t1)
- os.execute( [string command] )
- os.exit( [int code] )
- os.getenv(string var)
- os.remove(string path)
- os.rename(string old, string new)
- os.setlocale(string locale [, string category] )
- os.time( [table t] )
- os.tmpname()
Debug Functions
It is not really recommended to use these functions. They are internally by OpenTibia for error messages etc.
- debug.debug()
- debug.dump(mixed x)
- debug.getfenv( [coroutine co] )
- debug.gethook( [coroutine co] )
- debug.getinfo( [coroutine co,] function f [, string what] )
- debug.getlocal( [coroutine co,] int level, int stackindex)
- debug.getmetatable(mixed object)
- debug.getregistry()
- debug.getupvalue(function f, int index)
- debug.setfen(mixed objcet, table t)
- debug.sethook( [coroutine co,] function hook, string mask [, int count] )
- debug.setlocal( [coroutine co,] int level, int localindex, mixed value)
- debug.setmetatable(mixed object, table t)
- debug.setupvalue(function f, int upindex, mixed value)
- debug.traceback( [coroutine co,] [message] [, level] )
System Functions
System functions are not directly related to the game, but rather deal with internal state and script handling.
- stopListener(string ID)
- wait(int milliseconds)
- getConfigValue(string name)
- typeof(object instance, string class)
Game Functions
Functions that are not invoked on an object.
Classes
Event
Events are issued when something happends on the server, for more information, see Event Handling.
Thing
Functions that can be applied to Thing objects.
Creature
Creature objects inherit from Thing objects, that is, all Thing functions can be used on Creature objects.
Actor
Actors are creatures that have an AI.
Player
Player objects inherit from Creature objects.
Item
Item objects inherit from Thing objects.
Container
Container objects inherit from Item objects.
Map
Functions that can be invoked on the global Map object (called "map").
Tile
Functions that can be applied to Tiles.
House
Functions that be applied to Houses.
Waypoint
Functions that be applied to Waypoints.
Channel
Functions that can be applied on Channels.
| Revscriptsys Reference |
|---|
| List of functions · List of Event Types · List of Examples |
| Lua Libraries - string · table · coroutine · math · IO · OS · Debug |
| Classes - Thing · Creature · Player · Actor · NPC · Item · Container · Teleport · Combat · Condition · Spell · Map · Tile · Town · House · Waypoint · Channel · Command · Vocation · Event · Enum · Thread |
| Events - OnAccountLogin · OnAttack · OnAdvance · OnConditionAdded · OnConditionExpired · OnConditionTick · OnChangeOutfit · OnDamage · OnDeath · OnEquip · OnHear · OnJoinChannel · OnKill · OnLeaveChannel · OnLoadItem · OnLogin · OnLogout · OnLook · OnLoseCreature · OnMove · OnMoveItem · OnSay · OnServerLoad · OnServerUnload · OnSpawn · OnSpotCreature · OnTimer · OnTurn · OnUseItem |

