当前位置: 首页>>代码示例>>C++>>正文


C++ LFUNCVAL函数代码示例

本文整理汇总了C++中LFUNCVAL函数的典型用法代码示例。如果您正苦于以下问题:C++ LFUNCVAL函数的具体用法?C++ LFUNCVAL怎么用?C++ LFUNCVAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LFUNCVAL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: do_sleep_opt

  do_sleep_opt (L, 2);
  rtctime_deep_sleep_us (us); // does not return
  return 0;
}


// rtctime.dsleep_aligned (aligned_usec, min_usec, option)
static int rtctime_dsleep_aligned (lua_State *L)
{
  if (!rtctime_have_time ())
    return luaL_error (L, "time not available, unable to align");

  uint32_t align_us = luaL_checknumber (L, 1);
  uint32_t min_us = luaL_checknumber (L, 2);
  do_sleep_opt (L, 3);
  rtctime_deep_sleep_until_aligned_us (align_us, min_us); // does not return
  return 0;
}


// Module function map
static const LUA_REG_TYPE rtctime_map[] = {
  { LSTRKEY("set"),            LFUNCVAL(rtctime_set) },
  { LSTRKEY("get"),            LFUNCVAL(rtctime_get) },
  { LSTRKEY("dsleep"),         LFUNCVAL(rtctime_dsleep)  },
  { LSTRKEY("dsleep_aligned"), LFUNCVAL(rtctime_dsleep_aligned) },
  { LNILKEY, LNILVAL }
};

NODEMCU_MODULE(RTCTIME, "rtctime", rtctime_map, NULL);
开发者ID:Alvaro99CL,项目名称:nodemcu-firmware,代码行数:30,代码来源:rtctime.c

示例2: os_update_cpu_frequency

    os_update_cpu_frequency(CPU160MHZ);
  } else {
    REG_CLR_BIT(0x3ff00014,  BIT(0));
    os_update_cpu_frequency(CPU80MHZ);
  }
  new_freq = ets_get_cpu_frequency();
  lua_pushinteger(L, new_freq);
  return 1;
}

// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
const LUA_REG_TYPE node_map[] =
{
  { LSTRKEY( "restart" ), LFUNCVAL( node_restart ) },
  { LSTRKEY( "dsleep" ), LFUNCVAL( node_deepsleep ) },
  { LSTRKEY( "info" ), LFUNCVAL( node_info ) },
  { LSTRKEY( "chipid" ), LFUNCVAL( node_chipid ) },
  { LSTRKEY( "flashid" ), LFUNCVAL( node_flashid ) },
  { LSTRKEY( "flashsize" ), LFUNCVAL( node_flashsize) },
  { LSTRKEY( "heap" ), LFUNCVAL( node_heap ) },
#ifdef DEVKIT_VERSION_0_9
  { LSTRKEY( "key" ), LFUNCVAL( node_key ) },
  { LSTRKEY( "led" ), LFUNCVAL( node_led ) },
#endif
  { LSTRKEY( "input" ), LFUNCVAL( node_input ) },
  { LSTRKEY( "output" ), LFUNCVAL( node_output ) },
// Moved to adc module, use adc.readvdd33()  
// { LSTRKEY( "readvdd33" ), LFUNCVAL( node_readvdd33) },
  { LSTRKEY( "compile" ), LFUNCVAL( node_compile) },
开发者ID:AmenophisIII,项目名称:nodemcu-firmware,代码行数:31,代码来源:node.c

示例3: luaL_error

  if (result == LUA_ERR_CC_INTOVERFLOW) {
    return luaL_error(L, "value too big or small for target integer type");
  }
  if (result == LUA_ERR_CC_NOTINTEGER) {
    return luaL_error(L, "target lua_Number is integral but fractional value found");
  }

  return 0;
}

#define MIN_OPT_LEVEL   2
#include "lrodefs.h"
const LUA_REG_TYPE file_map[] =
{
  { LSTRKEY( "list" ), LFUNCVAL( file_list ) },
  { LSTRKEY( "slist" ), LFUNCVAL( file_slist ) },
  { LSTRKEY( "format" ), LFUNCVAL( file_format ) },
  { LSTRKEY( "open" ), LFUNCVAL( file_open ) },
  { LSTRKEY( "close" ), LFUNCVAL( file_close ) },
  { LSTRKEY( "write" ), LFUNCVAL( file_write ) },
  { LSTRKEY( "writeline" ), LFUNCVAL( file_writeline ) },
  { LSTRKEY( "read" ), LFUNCVAL( file_read ) },
  { LSTRKEY( "readline" ), LFUNCVAL( file_readline ) },
  { LSTRKEY( "remove" ), LFUNCVAL( file_remove ) },
  { LSTRKEY( "seek" ), LFUNCVAL( file_seek ) },
  { LSTRKEY( "flush" ), LFUNCVAL( file_flush ) },
  { LSTRKEY( "rename" ), LFUNCVAL( file_rename ) },
  { LSTRKEY( "info" ), LFUNCVAL( file_info ) },
  { LSTRKEY( "state" ), LFUNCVAL( file_state ) },
  { LSTRKEY( "compile" ), LFUNCVAL( file_compile ) },
开发者ID:fritsjek,项目名称:MICO-1,代码行数:30,代码来源:file.c

示例4: lua_tointeger

  int crc = 0;
  if(lua_isnumber(L, 2))
    crc = lua_tointeger(L, 2);
  if(crc > 65535)
    return luaL_error( L, "wrong arg range" );

  lua_pushinteger( L, onewire_crc16(pdata, (uint16_t)datalen, (uint16_t)crc) );

  return 1;
}
#endif
#endif

// Module function map
static const LUA_REG_TYPE ow_map[] = {
  { LSTRKEY( "setup" ),         LFUNCVAL( ow_setup ) },
  { LSTRKEY( "reset" ),         LFUNCVAL( ow_reset ) },
  { LSTRKEY( "skip" ),          LFUNCVAL( ow_skip ) },
  { LSTRKEY( "select" ),        LFUNCVAL( ow_select ) },
  { LSTRKEY( "write" ),         LFUNCVAL( ow_write ) },
  { LSTRKEY( "write_bytes" ),   LFUNCVAL( ow_write_bytes ) },
  { LSTRKEY( "read" ),          LFUNCVAL( ow_read ) },
  { LSTRKEY( "read_bytes" ),    LFUNCVAL( ow_read_bytes ) },
  { LSTRKEY( "depower" ),       LFUNCVAL( ow_depower ) },
#if ONEWIRE_SEARCH
  { LSTRKEY( "reset_search" ),  LFUNCVAL( ow_reset_search ) },
  { LSTRKEY( "target_search" ), LFUNCVAL( ow_target_search ) },
  { LSTRKEY( "search" ),        LFUNCVAL( ow_search ) },
#endif
#if ONEWIRE_CRC
  { LSTRKEY( "crc8" ),          LFUNCVAL( ow_crc8 ) },
开发者ID:Dxploto,项目名称:nodemcu-firmware,代码行数:31,代码来源:ow.c

示例5: luaL_error

        default: {  /* also treat cases `pnLlh' */
          return luaL_error(L, "invalid option " LUA_QL("%%%c") " to "
                               LUA_QL("format"), *(strfrmt - 1));
        }
      }
      luaL_addlstring(&b, buff, c_strlen(buff));
    }
  }
  luaL_pushresult(&b);
  return 1;
}

#define MIN_OPT_LEVEL 1
#include "lrodefs.h"
const LUA_REG_TYPE strlib[] = {
  {LSTRKEY("byte"), LFUNCVAL(str_byte)},
  {LSTRKEY("char"), LFUNCVAL(str_char)},
  {LSTRKEY("dump"), LFUNCVAL(str_dump)},
  {LSTRKEY("find"), LFUNCVAL(str_find)},
  {LSTRKEY("format"), LFUNCVAL(str_format)},
#if LUA_OPTIMIZE_MEMORY > 0 && defined(LUA_COMPAT_GFIND)
  {LSTRKEY("gfind"), LFUNCVAL(gmatch)},
#else
  {LSTRKEY("gfind"), LFUNCVAL(gfind_nodef)},
#endif
  {LSTRKEY("gmatch"), LFUNCVAL(gmatch)},
  {LSTRKEY("gsub"), LFUNCVAL(str_gsub)},
  {LSTRKEY("len"), LFUNCVAL(str_len)},
  {LSTRKEY("lower"), LFUNCVAL(str_lower)},
  {LSTRKEY("match"), LFUNCVAL(str_match)},
  {LSTRKEY("rep"), LFUNCVAL(str_rep)},
开发者ID:AbuShaqra,项目名称:nodemcu-firmware,代码行数:31,代码来源:lstrlib.c

示例6: version

}


// Lua: elua.version()
static int version( lua_State *L )
{
  lua_pushstring( L, ELUA_STR_VERSION );
  return 1;
}

// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
const LUA_REG_TYPE elua_map[] = 
{
  { LSTRKEY( "egc_setup" ), LFUNCVAL( egc_setup ) },
  { LSTRKEY( "version" ), LFUNCVAL( version ) },
#if LUA_OPTIMIZE_MEMORY > 0
  { LSTRKEY( "EGC_NOT_ACTIVE" ), LNUMVAL( EGC_NOT_ACTIVE ) },
  { LSTRKEY( "EGC_ON_ALLOC_FAILURE" ), LNUMVAL( EGC_ON_ALLOC_FAILURE ) },
  { LSTRKEY( "EGC_ON_MEM_LIMIT" ), LNUMVAL( EGC_ON_MEM_LIMIT ) },
  { LSTRKEY( "EGC_ALWAYS" ), LNUMVAL( EGC_ALWAYS ) },
#endif
  { LNILKEY, LNILVAL }
};

LUALIB_API int luaopen_elua( lua_State *L )
{
#if LUA_OPTIMIZE_MEMORY > 0
  return 0;
#else
开发者ID:BackupTheBerlios,项目名称:elua-svn,代码行数:31,代码来源:elua.c

示例7: wifi_ap_dhcp_stop

  return 1;
}

// Lua: wifi.ap.dhcp.stop()
static int wifi_ap_dhcp_stop( lua_State* L )
{
  lua_pushboolean(L, wifi_softap_dhcps_stop());
  return 1;
}

// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
static const LUA_REG_TYPE wifi_station_map[] =
{
  { LSTRKEY( "getconfig" ), LFUNCVAL ( wifi_station_getconfig ) },
  { LSTRKEY( "config" ), LFUNCVAL ( wifi_station_config ) },
  { LSTRKEY( "connect" ), LFUNCVAL ( wifi_station_connect4lua ) },
  { LSTRKEY( "disconnect" ), LFUNCVAL ( wifi_station_disconnect4lua ) },
  { LSTRKEY( "autoconnect" ), LFUNCVAL ( wifi_station_setauto ) },
  { LSTRKEY( "getip" ), LFUNCVAL ( wifi_station_getip ) },
  { LSTRKEY( "setip" ), LFUNCVAL ( wifi_station_setip ) },
  { LSTRKEY( "getbroadcast" ), LFUNCVAL ( wifi_station_getbroadcast) },
  { LSTRKEY( "getmac" ), LFUNCVAL ( wifi_station_getmac ) },
  { LSTRKEY( "setmac" ), LFUNCVAL ( wifi_station_setmac ) },
  { LSTRKEY( "getap" ), LFUNCVAL ( wifi_station_listap ) },
  { LSTRKEY( "status" ), LFUNCVAL ( wifi_station_status ) },
  { LSTRKEY( "eventMonReg" ), LFUNCVAL ( wifi_station_event_mon_reg ) },
  { LSTRKEY( "eventMonStart" ), LFUNCVAL ( wifi_station_event_mon_start ) },
  { LSTRKEY( "eventMonStop" ), LFUNCVAL ( wifi_station_event_mon_stop ) },
  { LNILKEY, LNILVAL }
开发者ID:tjclement,项目名称:nodemcu-firmware,代码行数:31,代码来源:wifi.c

示例8: strcpy

      case BOOT_REASON_EXPIN_RST:       strcpy(str,"EXPIN_RST");break;
      case BOOT_REASON_WDG_RST:         strcpy(str,"WDG_RST");break;
      case BOOT_REASON_WWDG_RST:        strcpy(str,"WWDG_RST");break;
      case BOOT_REASON_LOWPWR_RST:      strcpy(str,"LOWPWR_RST");break;
      case BOOT_REASON_BOR_RST:         strcpy(str,"BOR_RST");break;
      default:strcpy(str,"NONE");break;
    }
    lua_pushstring(L,str);
    return 1;
}

#define MIN_OPT_LEVEL       2
#include "lrodefs.h"
const LUA_REG_TYPE mcu_map[] =
{
  { LSTRKEY( "ver" ), LFUNCVAL( mcu_version )},
  { LSTRKEY( "info" ), LFUNCVAL( mcu_wifiinfo )},
  { LSTRKEY( "reboot" ), LFUNCVAL( mcu_reboot )},
  { LSTRKEY( "mem" ), LFUNCVAL( mcu_memory )},
  { LSTRKEY( "chipid" ), LFUNCVAL( mcu_chipid )},
  { LSTRKEY( "bootreason" ), LFUNCVAL(mcu_bootreason)},
  { LSTRKEY( "getparams" ), LFUNCVAL(get_params)},
  { LSTRKEY( "sgetparams" ), LFUNCVAL(get_sparams)},
  { LSTRKEY( "setparams" ), LFUNCVAL(set_sparams)},
  { LSTRKEY( "queuepush" ), LFUNCVAL(queue_push)},
  { LSTRKEY( "random" ), LFUNCVAL(mcu_random)},
#if LUA_OPTIMIZE_MEMORY > 0
#endif      
  {LNILKEY, LNILVAL}
};
开发者ID:fritsjek,项目名称:MICO-1,代码行数:30,代码来源:mcu.c

示例9: net_lookup

// Lua: iptype = lookup( "name" )
static int net_lookup( lua_State *L )
{
	const char *name = luaL_checkstring( L, 1 );
	elua_net_ip res;

	res = elua_net_lookup( name );
	lua_pushinteger( L, res.ipaddr );
	return 1;
}

// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
const LUA_REG_TYPE net_map[] = {
	{ LSTRKEY( "accept" ), LFUNCVAL( net_accept ) },
	{ LSTRKEY( "packip" ), LFUNCVAL( net_packip ) },
	{ LSTRKEY( "unpackip" ), LFUNCVAL( net_unpackip ) },
	{ LSTRKEY( "connect" ), LFUNCVAL( net_connect ) },
	{ LSTRKEY( "socket" ), LFUNCVAL( net_socket ) },
	{ LSTRKEY( "close" ), LFUNCVAL( net_close ) },
	{ LSTRKEY( "send" ), LFUNCVAL( net_send ) },
	{ LSTRKEY( "recv" ), LFUNCVAL( net_recv ) },
	{ LSTRKEY( "lookup" ), LFUNCVAL( net_lookup ) },
#if LUA_OPTIMIZE_MEMORY > 0
	{ LSTRKEY( "SOCK_STREAM" ), LNUMVAL( ELUA_NET_SOCK_STREAM ) },
	{ LSTRKEY( "SOCK_DGRAM" ), LNUMVAL( ELUA_NET_SOCK_DGRAM ) },
	{ LSTRKEY( "ERR_OK" ), LNUMVAL( ELUA_NET_ERR_OK ) },
	{ LSTRKEY( "ERR_TIMEOUT" ), LNUMVAL( ELUA_NET_ERR_TIMEDOUT ) },
	{ LSTRKEY( "ERR_CLOSED" ), LNUMVAL( ELUA_NET_ERR_CLOSED ) },
	{ LSTRKEY( "ERR_ABORTED" ), LNUMVAL( ELUA_NET_ERR_ABORTED ) },
开发者ID:Amalinda,项目名称:ruuvitracker_fw,代码行数:31,代码来源:net.c

示例10: pio_mt_index

}
#else
extern int pio_mt_index( lua_State* L );
extern int pio_decode( lua_State *L );
#endif



// *****************************************************************************
// Pin function map

#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
static const LUA_REG_TYPE pio_pin_map[] =
{
  { LSTRKEY( "setdir" ), LFUNCVAL ( pio_pin_setdir ) },
  { LSTRKEY( "output" ), LFUNCVAL( pio_pin_output ) },
  { LSTRKEY( "input" ), LFUNCVAL( pio_pin_input ) },
  { LSTRKEY( "setpull" ), LFUNCVAL( pio_pin_setpull ) },
  { LSTRKEY( "setval" ), LFUNCVAL( pio_pin_setval ) },
  { LSTRKEY( "sethigh" ), LFUNCVAL( pio_pin_sethigh ) },
  { LSTRKEY( "setlow" ), LFUNCVAL( pio_pin_setlow ) },
  { LSTRKEY( "getval" ), LFUNCVAL( pio_pin_getval ) },
  { LNILKEY, LNILVAL }
};

static const LUA_REG_TYPE pio_port_map[] =
{
  { LSTRKEY( "setdir" ), LFUNCVAL( pio_port_setdir ) },
  { LSTRKEY( "output" ), LFUNCVAL( pio_port_output ) },
  { LSTRKEY( "input" ), LFUNCVAL( pio_port_input ) },
开发者ID:rbarzic,项目名称:elua-evk1104,代码行数:31,代码来源:pio.c

示例11: luaL_error

        return luaL_error( L, "invalid number" );
      platform_uart_send( id, ( u8 )len );
    }
    else
    {
      luaL_checktype( L, s, LUA_TSTRING );
      buf = lua_tolstring( L, s, &len );
      for( i = 0; i < len; i ++ )
        platform_uart_send( id, buf[ i ] );
    }
  }
  return 0;
}

// Module function map
static const LUA_REG_TYPE uart_map[] =  {
  { LSTRKEY( "setup" ), LFUNCVAL( uart_setup ) },
  { LSTRKEY( "write" ), LFUNCVAL( uart_write ) },
  { LSTRKEY( "on" ),    LFUNCVAL( uart_on ) },
  { LSTRKEY( "alt" ),   LFUNCVAL( uart_alt ) },
  { LSTRKEY( "STOPBITS_1" ),   LNUMVAL( PLATFORM_UART_STOPBITS_1 ) },
  { LSTRKEY( "STOPBITS_1_5" ), LNUMVAL( PLATFORM_UART_STOPBITS_1_5 ) },
  { LSTRKEY( "STOPBITS_2" ),   LNUMVAL( PLATFORM_UART_STOPBITS_2 ) },
  { LSTRKEY( "PARITY_NONE" ),  LNUMVAL( PLATFORM_UART_PARITY_NONE ) },
  { LSTRKEY( "PARITY_EVEN" ),  LNUMVAL( PLATFORM_UART_PARITY_EVEN ) },
  { LSTRKEY( "PARITY_ODD" ),   LNUMVAL( PLATFORM_UART_PARITY_ODD ) },
  { LNILKEY, LNILVAL }
};

NODEMCU_MODULE(UART, "uart", uart_map, NULL);
开发者ID:Alvaro99CL,项目名称:nodemcu-firmware,代码行数:30,代码来源:uart.c

示例12: LSTRKEY

	{ LSTRKEY( "DeviceInSilentState" ),	 LINTVAL( LORA_DEVICE_IN_SILENT_STATE ) },
	{ LSTRKEY( "DeviceIsNotIdle" ),		 LINTVAL( LORA_DEVICE_DEVICE_IS_NOT_IDLE ) },
	{ LSTRKEY( "Paused" ),		         LINTVAL( LORA_PAUSED ) },
	{ LSTRKEY( "Timeout" ),		         LINTVAL( LORA_TIMEOUT ) },
	{ LSTRKEY( "JoinDenied" ),		     LINTVAL( LORA_JOIN_DENIED ) },
	{ LSTRKEY( "UnexpectedResponse" ),	 LINTVAL( LORA_UNEXPECTED_RESPONSE ) },
	{ LSTRKEY( "NotJoined" ),		     LINTVAL( LORA_NOT_JOINED ) },
	{ LSTRKEY( "RejoinNeeded" ),		 LINTVAL( LORA_REJOIN_NEEDED ) },
	{ LSTRKEY( "InvalidDataLen" ),		 LINTVAL( LORA_INVALID_DATA_LEN ) },
	{ LSTRKEY( "TransmissionFail" ),	 LINTVAL( LORA_TRANSMISSION_FAIL_ACK_NOT_RECEIVED ) },
	{ LSTRKEY( "NotSetup" ),		     LINTVAL( LORA_NOT_SETUP ) },
	{ LSTRKEY( "InvalidArgument" ),		 LINTVAL( LORA_INVALID_PARAM ) },
};

static const LUA_REG_TYPE lora_map[] = {
    { LSTRKEY( "setup" ),        LFUNCVAL( llora_setup ) }, 
    { LSTRKEY( "setDevAddr" ),   LFUNCVAL( llora_set_setDevAddr ) }, 
    { LSTRKEY( "setDevEui" ),    LFUNCVAL( llora_set_DevEui ) }, 
    { LSTRKEY( "setAppEui" ),    LFUNCVAL( llora_set_AppEui ) }, 
    { LSTRKEY( "setAppKey" ),    LFUNCVAL( llora_set_AppKey ) }, 
    { LSTRKEY( "setNwksKey" ),   LFUNCVAL( llora_set_NwkSKey ) }, 
    { LSTRKEY( "setAppsKey" ),   LFUNCVAL( llora_set_AppSKey ) }, 
    { LSTRKEY( "setAppKey" ),    LFUNCVAL( llora_set_AppKey ) }, 
    { LSTRKEY( "setDr" ),        LFUNCVAL( llora_set_Dr ) }, 
    { LSTRKEY( "setAdr" ),       LFUNCVAL( llora_set_Adr ) }, 
    { LSTRKEY( "setRetX" ),      LFUNCVAL( llora_set_RetX ) }, 
    { LSTRKEY( "setLinkChk" ),   LFUNCVAL( llora_set_LinkChk ) }, // MUST DO
    { LSTRKEY( "setRxDelay1" ),  LFUNCVAL( llora_nothing ) }, 
    { LSTRKEY( "setAr" ),        LFUNCVAL( llora_set_Ar ) }, 
    { LSTRKEY( "setRx2" ),       LFUNCVAL( llora_nothing ) }, // MUST DO
    { LSTRKEY( "setChFreq" ),    LFUNCVAL( llora_nothing ) }, // MUST DO
开发者ID:whitecatboard,项目名称:LuaOS,代码行数:31,代码来源:lora.c

示例13: luaL_checkstack

    luaL_checkstack(L, 40, "");  /* assume array is smaller than 2^40 */
    if (!lua_isnoneornil(L, 2))  /* is there a 2nd argument? */
      luaL_checktype(L, 2, LUA_TFUNCTION);  /* must be a function */
    lua_settop(L, 2);  /* make sure there are two arguments */
    auxsort(L, 1, (unsigned int)n, 0u);
  }
  return 0;
}

/* }====================================================== */


#include "modules.h"

static const LUA_REG_TYPE tab_funcs[] = {
  { LSTRKEY( "concat" ),		LFUNCVAL( tconcat ) },
#if defined(LUA_COMPAT_MAXN)
  { LSTRKEY( "maxn" ),			LFUNCVAL( maxn ) },
#endif
  { LSTRKEY( "insert" ),		LFUNCVAL( tinsert ) },
  { LSTRKEY( "pack" ),			LFUNCVAL( pack ) },
  { LSTRKEY( "unpack" ),		LFUNCVAL( unpack ) },
  { LSTRKEY( "remove" ),		LFUNCVAL( tremove ) },
  { LSTRKEY( "move" ),			LFUNCVAL( tmove ) },
  { LSTRKEY( "sort" ),			LFUNCVAL( sort ) },
  { LNILKEY, LNILVAL }
};


LUAMOD_API int luaopen_table (lua_State *L) {
 #if !LUA_USE_ROTABLE
开发者ID:whitecatboard,项目名称:LuaOS,代码行数:31,代码来源:ltablib.c

示例14: MicoUartSend

      MicoUartSend( LUA_USR_UART,(char*)len,1);
    }
    else
    {
      luaL_checktype( L, s, LUA_TSTRING );
      buf = lua_tolstring( L, s, &len );
      MicoUartSend( LUA_USR_UART, buf,len);
    }
  }
  return 0;
}
#define MIN_OPT_LEVEL   2
#include "lrodefs.h"
const LUA_REG_TYPE uart_map[] =
{
  { LSTRKEY( "setup" ), LFUNCVAL( uart_setup )},
  { LSTRKEY( "on" ), LFUNCVAL( uart_on )},
  { LSTRKEY( "send" ), LFUNCVAL( uart_send )},
#if LUA_OPTIMIZE_MEMORY > 0
#endif      
  {LNILKEY, LNILVAL}
};

LUALIB_API int luaopen_uart(lua_State *L)
{
#if LUA_OPTIMIZE_MEMORY > 0
    return 0;
#else  
  luaL_register( L, EXLIB_UART, uart_map );
  return 1;
#endif
开发者ID:SmartArduino,项目名称:MICO-1,代码行数:31,代码来源:uart.c

示例15: luaL_checkinteger

  y      = luaL_checkinteger(L, 3);
  width  = luaL_checkinteger(L, 4);
  height = luaL_checkinteger(L, 5);
  lm3s_disp_imageDraw(( const unsigned char* )img, x, y, width, height);
  return 0; 
}   



#define MIN_OPT_LEVEL 2
#include "lrodefs.h"  

// Module function map
const LUA_REG_TYPE disp_map[] =
{ 
  { LSTRKEY( "init" ),  LFUNCVAL( disp_init ) },
  { LSTRKEY( "enable" ),  LFUNCVAL( disp_enable ) },
  { LSTRKEY( "disable" ), LFUNCVAL( disp_disable ) },
  { LSTRKEY( "on" ), LFUNCVAL( disp_on ) },    
  { LSTRKEY( "off" ), LFUNCVAL( disp_off ) },
  { LSTRKEY( "clear" ), LFUNCVAL( disp_clear ) },
  { LSTRKEY( "print" ), LFUNCVAL( disp_stringDraw ) },
  { LSTRKEY( "draw" ), LFUNCVAL( disp_imageDraw ) },  
  { LNILKEY, LNILVAL }
};

LUALIB_API int luaopen_disp( lua_State *L )
{
  LREGISTER( L, AUXLIB_DISP, disp_map );
}  
开发者ID:BackupTheBerlios,项目名称:elua-svn,代码行数:30,代码来源:disp.c


注:本文中的LFUNCVAL函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。