⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tvariablebind.c

📁 tolua++是一个对lua进行封装调用的工具
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
** Lua binding: tvariable
** Generated automatically by tolua 5.0a-CDLVS2 on 08/08/03 17:06:18.
*/

#ifndef __cplusplus
#include "stdlib.h"
#endif
#include "string.h"

#include "tolua.h"

/* Exported function */
TOLUA_API int tolua_tvariable_open (lua_State* tolua_S);

#include "tvariable.h"

/* function to register type */
static void tolua_reg_types (lua_State* tolua_S)
{
 tolua_usertype(tolua_S,"A");
 tolua_usertype(tolua_S,"U");
 tolua_usertype(tolua_S,"B");
}

/* get function: i of class  A */
static int tolua_get_A_i(lua_State* tolua_S)
{
  A* self = (A*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'i'",NULL);
#endif
 tolua_pushnumber(tolua_S,(double)self->i);
 return 1;
}

/* set function: i of class  A */
static int tolua_set_A_i(lua_State* tolua_S)
{
  A* self = (A*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'i'",NULL);
 if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->i = ((int)  tolua_tonumber(tolua_S,2,0));
 return 0;
}

/* get function: f of class  A */
static int tolua_get_A_f(lua_State* tolua_S)
{
  A* self = (A*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'f'",NULL);
#endif
 tolua_pushnumber(tolua_S,(double)self->f);
 return 1;
}

/* set function: f of class  A */
static int tolua_set_A_f(lua_State* tolua_S)
{
  A* self = (A*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'f'",NULL);
 if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->f = ((float)  tolua_tonumber(tolua_S,2,0));
 return 0;
}

/* get function: d of class  A */
static int tolua_get_A_d(lua_State* tolua_S)
{
  A* self = (A*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'd'",NULL);
#endif
 tolua_pushnumber(tolua_S,(double)self->d);
 return 1;
}

/* set function: d of class  A */
static int tolua_set_A_d(lua_State* tolua_S)
{
  A* self = (A*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'd'",NULL);
 if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->d = ((double)  tolua_tonumber(tolua_S,2,0));
 return 0;
}

/* get function: s of class  A */
static int tolua_get_A_s(lua_State* tolua_S)
{
  A* self = (A*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 's'",NULL);
#endif
 tolua_pushstring(tolua_S,(const char*)self->s);
 return 1;
}

/* set function: s of class  A */
static int tolua_set_A_s(lua_State* tolua_S)
{
  A* self = (A*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 's'",NULL);
 if (!tolua_isstring(tolua_S,2,0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->s = ((char*)  tolua_tostring(tolua_S,2,0));
 return 0;
}

/* get function: v of class  A */
static int tolua_get_A_v(lua_State* tolua_S)
{
  A* self = (A*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'v'",NULL);
#endif
 tolua_pushuserdata(tolua_S,(void*)self->v);
 return 1;
}

/* set function: v of class  A */
static int tolua_set_A_v(lua_State* tolua_S)
{
  A* self = (A*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'v'",NULL);
 if (!tolua_isuserdata(tolua_S,2,0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->v = ((void*)  tolua_touserdata(tolua_S,2,0));
 return 0;
}

/* get function: n of class  A */
static int tolua_get_A_n(lua_State* tolua_S)
{
  A* self = (A*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'n'",NULL);
#endif
 tolua_pushstring(tolua_S,(const char*)self->n);
 return 1;
}

/* set function: n of class  A */
static int tolua_set_A_n(lua_State* tolua_S)
{
  A* self = (A*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'n'",NULL);
 if (!tolua_isstring(tolua_S,2,0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
 strncpy(self->n,tolua_tostring(tolua_S,2,0),64-1);
 return 0;
}

/* get function: a of class  B */
static int tolua_get_B_a(lua_State* tolua_S)
{
  B* self = (B*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'a'",NULL);
#endif
 tolua_pushusertype(tolua_S,(void*)&self->a,"A");
 return 1;
}

/* set function: a of class  B */
static int tolua_set_B_a(lua_State* tolua_S)
{
  B* self = (B*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'a'",NULL);
 if (!tolua_isusertype(tolua_S,2,"A",0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->a = *((A*)  tolua_tousertype(tolua_S,2,0));
 return 0;
}

/* get function: b of class  B */
static int tolua_get_B_b_ptr(lua_State* tolua_S)
{
  B* self = (B*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'b'",NULL);
#endif
 tolua_pushusertype(tolua_S,(void*)self->b,"B");
 return 1;
}

/* set function: b of class  B */
static int tolua_set_B_b_ptr(lua_State* tolua_S)
{
  B* self = (B*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'b'",NULL);
 if (!tolua_isusertype(tolua_S,2,"B",0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->b = ((B*)  tolua_tousertype(tolua_S,2,0));
 return 0;
}

/* get function: i of class  U */
static int tolua_get_U_i(lua_State* tolua_S)
{
  U* self = (U*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'i'",NULL);
#endif
 tolua_pushnumber(tolua_S,(double)self->i);
 return 1;
}

/* set function: i of class  U */
static int tolua_set_U_i(lua_State* tolua_S)
{
  U* self = (U*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'i'",NULL);
 if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->i = ((int)  tolua_tonumber(tolua_S,2,0));
 return 0;
}

/* get function: f of class  U */
static int tolua_get_U_f(lua_State* tolua_S)
{
  U* self = (U*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'f'",NULL);
#endif
 tolua_pushnumber(tolua_S,(double)self->f);
 return 1;
}

/* set function: f of class  U */
static int tolua_set_U_f(lua_State* tolua_S)
{
  U* self = (U*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'f'",NULL);
 if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->f = ((float)  tolua_tonumber(tolua_S,2,0));
 return 0;
}

/* get function: i */
static int tolua_get_i(lua_State* tolua_S)
{
 tolua_pushnumber(tolua_S,(double)i);
 return 1;
}

/* set function: i */
static int tolua_set_i(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  i = ((int)  tolua_tonumber(tolua_S,2,0));
 return 0;
}

/* get function: f */
static int tolua_get_f(lua_State* tolua_S)
{
 tolua_pushnumber(tolua_S,(double)f);
 return 1;
}

/* set function: f */
static int tolua_set_f(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  f = ((float)  tolua_tonumber(tolua_S,2,0));
 return 0;
}

/* get function: d */
static int tolua_get_d(lua_State* tolua_S)
{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -