cluautil.h File Reference

#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>

Include dependency graph for cluautil.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MonsterWrap

Defines

#define LUAFN(name)   static int name(lua_State *ls)
#define LUAWRAP(name, wrapexpr)
#define PLUARET(type, val)
#define LUARET1(name, type, val)
#define LUARET2(name, type, val1, val2)
#define ASSERT_DLUA
#define GETCOORD(c, p1, p2, boundfn)
#define COORDS(c, p1, p2)   GETCOORD(c, p1, p2, in_bounds)
#define COORDSHOW(c, p1, p2)   GETCOORD(c, p1, p2, in_show_bounds)
#define FEAT(f, pos)   dungeon_feature_type f = check_lua_feature(ls, pos)
#define LEVEL(lev, br, pos)
#define MAP(ls, n, var)   map_def *var = *(map_def **) luaL_checkudata(ls, n, MAP_METATABLE)
#define LINES(ls, n, var)   map_lines &var = (*(map_def **) luaL_checkudata(ls, n, MAP_METATABLE))->map
#define DEVENT(ls, n, var)   dgn_event *var = *(dgn_event **) luaL_checkudata(ls, n, DEVENT_METATABLE)
#define MAPMARKER(ls, n, var)   map_marker *var = *(map_marker **) luaL_checkudata(ls, n, MAPMARK_METATABLE)
#define LUA_ITEM(ls, name, n)   item_def *item = *(item_def **) luaL_checkudata(ls, n, ITEM_METATABLE)

Functions

void luaopen_setmeta (lua_State *ls, const char *global, const luaL_reg *lua_lib, const char *meta)
void clua_register_metatable (lua_State *ls, const char *tn, const luaL_reg *lr, int(*gcfn)(lua_State *ls)=NULL)
int clua_stringtable (lua_State *ls, const std::vector< std::string > &s)
template<class T>
T * clua_new_userdata (lua_State *ls, const char *mt)
template<typename T>
void dlua_push_userdata (lua_State *ls, T udata, const char *meta)
int push_activity_interrupt (lua_State *ls, activity_interrupt_data *t)
void clua_push_map (lua_State *ls, map_def *map)
void clua_push_coord (lua_State *ls, const coord_def &c)
void clua_push_dgn_event (lua_State *ls, const dgn_event *devent)
void push_monster (lua_State *ls, monster *mons)
void clua_push_item (lua_State *ls, item_def *item)
item_defclua_get_item (lua_State *ls, int ndx)
void lua_push_floor_items (lua_State *ls, int link)
dungeon_feature_type check_lua_feature (lua_State *ls, int idx)
unsigned int get_tile_idx (lua_State *ls, int arg)
level_id dlua_level_id (lua_State *ls, int ndx)
void push_item (lua_State *ls, item_def *item)
int clua_pushcxxstring (lua_State *ls, const std::string &s)
int clua_pushpoint (lua_State *ls, const coord_def &pos)


Define Documentation

#define ASSERT_DLUA

Value:

do {                                                            \
        if (CLua::get_vm(ls).managed_vm)                            \
            luaL_error(ls, "Operation forbidden in end-user script");   \
    } while (false)

#define COORDS ( c,
p1,
p2   )     GETCOORD(c, p1, p2, in_bounds)

#define COORDSHOW ( c,
p1,
p2   )     GETCOORD(c, p1, p2, in_show_bounds)

#define DEVENT ( ls,
n,
var   )     dgn_event *var = *(dgn_event **) luaL_checkudata(ls, n, DEVENT_METATABLE)

#define FEAT ( f,
pos   )     dungeon_feature_type f = check_lua_feature(ls, pos)

#define GETCOORD ( c,
p1,
p2,
boundfn   ) 

Value:

coord_def c;                                          \
    c.x = luaL_checkint(ls, p1);                          \
    c.y = luaL_checkint(ls, p2);                          \
    if (!boundfn(c))                                        \
        luaL_error(                                          \
            ls,                                                 \
            make_stringf("Point (%d,%d) is out of bounds",      \
                         c.x, c.y).c_str());                    \
    else ;

#define LEVEL ( lev,
br,
pos   ) 

Value:

const char *level_name = luaL_checkstring(ls, pos);                 \
level_area_type lev = str_to_level_area_type(level_name);           \
if (lev == NUM_LEVEL_AREA_TYPES)                                    \
luaL_error(ls, "Expected level name");                          \
const char *branch_name = luaL_checkstring(ls, pos);                \
branch_type br = str_to_branch(branch_name);                        \
if (lev == LEVEL_DUNGEON && br == NUM_BRANCHES)                     \
luaL_error(ls, "Expected branch name");

#define LINES ( ls,
n,
var   )     map_lines &var = (*(map_def **) luaL_checkudata(ls, n, MAP_METATABLE))->map

#define LUA_ITEM ( ls,
name,
 )     item_def *item = *(item_def **) luaL_checkudata(ls, n, ITEM_METATABLE)

#define LUAFN ( name   )     static int name(lua_State *ls)

#define LUARET1 ( name,
type,
val   ) 

Value:

static int name(lua_State *ls) \
    { \
        lua_push##type(ls, val); \
        return (1); \
    }

#define LUARET2 ( name,
type,
val1,
val2   ) 

Value:

static int name(lua_State *ls) \
    { \
        lua_push##type(ls, val1); \
        lua_push##type(ls, val2); \
        return (2); \
    }

#define LUAWRAP ( name,
wrapexpr   ) 

Value:

static int name(lua_State *ls) \
    {   \
        wrapexpr; \
        return (0); \
    }

#define MAP ( ls,
n,
var   )     map_def *var = *(map_def **) luaL_checkudata(ls, n, MAP_METATABLE)

#define MAPMARKER ( ls,
n,
var   )     map_marker *var = *(map_marker **) luaL_checkudata(ls, n, MAPMARK_METATABLE)

#define PLUARET ( type,
val   ) 

Value:

lua_push##type(ls, val); \
        return (1);


Function Documentation

dungeon_feature_type check_lua_feature ( lua_State *  ls,
int  idx 
)

item_def* clua_get_item ( lua_State *  ls,
int  ndx 
)

Here is the call graph for this function:

template<class T>
T* clua_new_userdata ( lua_State *  ls,
const char *  mt 
) [inline]

void clua_push_coord ( lua_State *  ls,
const coord_def c 
)

void clua_push_dgn_event ( lua_State *  ls,
const dgn_event devent 
)

void clua_push_item ( lua_State *  ls,
item_def item 
)

void clua_push_map ( lua_State *  ls,
map_def map 
)

int clua_pushcxxstring ( lua_State *  ls,
const std::string s 
)

int clua_pushpoint ( lua_State *  ls,
const coord_def pos 
)

Here is the call graph for this function:

void clua_register_metatable ( lua_State *  ls,
const char *  tn,
const luaL_reg *  lr,
int(*)(lua_State *ls)  gcfn = NULL 
)

int clua_stringtable ( lua_State *  ls,
const std::vector< std::string > &  s 
)

Here is the call graph for this function:

level_id dlua_level_id ( lua_State *  ls,
int  ndx 
)

template<typename T>
void dlua_push_userdata ( lua_State *  ls,
udata,
const char *  meta 
) [inline]

unsigned int get_tile_idx ( lua_State *  ls,
int  arg 
)

void lua_push_floor_items ( lua_State *  ls,
int  link 
)

Here is the call graph for this function:

void luaopen_setmeta ( lua_State *  ls,
const char *  global,
const luaL_reg *  lua_lib,
const char *  meta 
)

int push_activity_interrupt ( lua_State *  ls,
activity_interrupt_data t 
)

Here is the call graph for this function:

void push_item ( lua_State *  ls,
item_def item 
)

void push_monster ( lua_State *  ls,
monster mons 
)


Generated on Thu Jan 13 13:03:34 2011 by  doxygen 1.5.6