00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef TOLUA_H
00016 #define TOLUA_H
00017
00018 #ifndef TOLUA_API
00019 #define TOLUA_API extern
00020 #endif
00021
00022 #define TOLUA_VERSION "tolua++-1.0.92"
00023
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027
00028 #define tolua_pushcppstring(x,y) tolua_pushstring(x,y.c_str())
00029 #define tolua_iscppstring tolua_isstring
00030
00031 #define tolua_iscppstringarray tolua_isstringarray
00032 #define tolua_pushfieldcppstring(L,lo,idx,s) tolua_pushfieldstring(L, lo, idx, s.c_str())
00033
00034 #define TEMPLATE_BIND(p)
00035 #define TOLUA_TEMPLATE_BIND(p)
00036 #define TOLUA_PROTECTED_DESTRUCTOR
00037 #define TOLUA_PROPERTY_TYPE(p)
00038
00039 typedef int lua_Object;
00040
00041 #include "lua.h"
00042 #include "lauxlib.h"
00043
00044 struct tolua_Error
00045 {
00046 int index;
00047 int array;
00048 const char* type;
00049 };
00050 typedef struct tolua_Error tolua_Error;
00051
00052 #define TOLUA_NOPEER LUA_REGISTRYINDEX
00053
00054 TOLUA_API const char* tolua_typename (lua_State* L, int lo);
00055 TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err);
00056 TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err);
00057 TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err);
00058 TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err);
00059 TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err);
00060 TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err);
00061 TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err);
00062 TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err);
00063 TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err);
00064 TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err);
00065 TOLUA_API int tolua_isvaluearray
00066 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
00067 TOLUA_API int tolua_isbooleanarray
00068 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
00069 TOLUA_API int tolua_isnumberarray
00070 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
00071 TOLUA_API int tolua_isstringarray
00072 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
00073 TOLUA_API int tolua_istablearray
00074 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
00075 TOLUA_API int tolua_isuserdataarray
00076 (lua_State* L, int lo, int dim, int def, tolua_Error* err);
00077 TOLUA_API int tolua_isusertypearray
00078 (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err);
00079
00080 TOLUA_API void tolua_open (lua_State* L);
00081
00082 TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size);
00083 TOLUA_API int tolua_register_gc (lua_State* L, int lo);
00084 TOLUA_API int tolua_default_collect (lua_State* tolua_S);
00085
00086 TOLUA_API void tolua_usertype (lua_State* L, const char* type);
00087 TOLUA_API void tolua_beginmodule (lua_State* L, const char* name);
00088 TOLUA_API void tolua_endmodule (lua_State* L);
00089 TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar);
00090 TOLUA_API void tolua_class (lua_State* L, char* name, char* base);
00091 TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col);
00092 TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func);
00093 TOLUA_API void tolua_constant (lua_State* L, const char* name, double value);
00094 TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set);
00095 TOLUA_API void tolua_array (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set);
00096
00097
00098
00099
00100 TOLUA_API void tolua_pushvalue (lua_State* L, int lo);
00101 TOLUA_API void tolua_pushboolean (lua_State* L, int value);
00102 TOLUA_API void tolua_pushnumber (lua_State* L, double value);
00103 TOLUA_API void tolua_pushstring (lua_State* L, const char* value);
00104 TOLUA_API void tolua_pushuserdata (lua_State* L, void* value);
00105 TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type);
00106 TOLUA_API void tolua_pushusertype_and_takeownership(lua_State* L, void* value, const char* type);
00107 TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v);
00108 TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v);
00109 TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, double v);
00110 TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v);
00111 TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v);
00112 TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type);
00113 TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type);
00114
00115 TOLUA_API double tolua_tonumber (lua_State* L, int narg, double def);
00116 TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def);
00117 TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def);
00118 TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def);
00119 TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def);
00120 TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def);
00121 TOLUA_API double tolua_tofieldnumber (lua_State* L, int lo, int index, double def);
00122 TOLUA_API const char* tolua_tofieldstring (lua_State* L, int lo, int index, const char* def);
00123 TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def);
00124 TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def);
00125 TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def);
00126 TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def);
00127
00128 TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name);
00129
00130 TOLUA_API int class_gc_event (lua_State* L);
00131
00132 #ifdef __cplusplus
00133 static inline const char* tolua_tocppstring (lua_State* L, int narg, const char* def) {
00134
00135 const char* s = tolua_tostring(L, narg, def);
00136 return s?s:"";
00137 };
00138
00139 static inline const char* tolua_tofieldcppstring (lua_State* L, int lo, int index, const char* def) {
00140
00141 const char* s = tolua_tofieldstring(L, lo, index, def);
00142 return s?s:"";
00143 };
00144
00145 #else
00146 #define tolua_tocppstring tolua_tostring
00147 #define tolua_tofieldcppstring tolua_tofieldstring
00148 #endif
00149
00150 TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index);
00151
00152 #ifdef __cplusplus
00153 }
00154 #endif
00155
00156 #endif