C操作Lua虛擬棧的API

來源:互聯網
上載者:User

標籤:style   blog   color   ar   div   sp   log   on   c   

Lua是一種嵌入式語言,在C中通過Lua庫來執行,Lua和C的通訊要通過一個虛擬棧。

C的API:

操作棧函數

 1 /*壓入棧函數 lua_psuhtype*/ 2 void lua_pushnil       (lua_State *L);                                     3 void lua_pushboolean   (lua_State *L, int bool); 4 void lua_pushnumber    (lua_State *L, lua_Number n); 5 void lua_pushinteger   (lua_State *L, lua_Integer n); 6 void lua_pushunsigned  (lua_State *L, lua_Unsigned n); 7 void lua_pushlstring   (lua_State *L, const char *s, size_t len); 8 void lua_pushstring    (lua_State *L, const char *s); 9 /*檢測棧空間*/10 int lua_checkstack (lua_State *L, int sz);

 查詢棧函數

/*檢測棧元素能否轉化為對應類型*/int lua_is* (lua_State *L, int index);/*返回棧元素類型*/int lua_type (lua_State *L, int index);/*返回棧元素對應值*/int lua_toboolean (lua_State *L, int index);const char *lua_tolstring (lua_State *L, int index, size_t *len);lua_Number lua_tonumber (lua_State *L, int index);lua_Integer lua_tointeger (lua_State *L, int index);lua_Unsigned lua_tounsigned (lua_State *L, int idx);

 

C操作Lua虛擬棧的API

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.