naev 0.12.5
nlua_vec2.h
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
4#pragma once
5
6#include "nlua.h"
7#include "physics.h"
8
9#define VECTOR_METATABLE "vec2"
10
11/* Helper. */
12#define luaL_optvector( L, ind, def ) \
13 nluaL_optarg( L, ind, def, luaL_checkvector )
14
15/*
16 * Vector library.
17 */
18int nlua_loadVector( nlua_env env );
19
20/*
21 * Vector operations.
22 */
23vec2 *lua_tovector( lua_State *L, int ind );
24vec2 *luaL_checkvector( lua_State *L, int ind );
25vec2 *lua_pushvector( lua_State *L, vec2 vec );
26int lua_isvector( lua_State *L, int ind );
int nlua_loadVector(nlua_env env)
Loads the vector metatable.
Definition nlua_vec2.c:85
int lua_isvector(lua_State *L, int ind)
Checks to see if ind is a vector.
Definition nlua_vec2.c:161
vec2 * luaL_checkvector(lua_State *L, int ind)
Gets vector at index making sure type is valid.
Definition nlua_vec2.c:130
vec2 * lua_tovector(lua_State *L, int ind)
Represents a 2D vector in Lua.
Definition nlua_vec2.c:119
vec2 * lua_pushvector(lua_State *L, vec2 vec)
Pushes a vector on the stack.
Definition nlua_vec2.c:145
Represents a 2d vector.
Definition vec2.h:45