UID135269
帖子
精華
主題
積分4983
現金
積極性
威望
違規
熱心
推廣次數
閱讀權限20
註冊時間2009-2-26
在線時間 小時
最後登錄1970-1-1
TA的每日心情 | 開心 2019-6-13 09:37 PM |
---|
簽到天數: 705 天 連續簽到: 3 天 [LV.9]以壇為家II
|
本帖最後由 jqkeric11 於 2017-4-29 09:15 PM 編輯
- /// Returns the script_data at the target index
- #define script_getdata(st,i) ( &((st)->stack->stack_data[(st)->start + (i)]) )
- /// Returns if the stack contains data at the target index
- #define script_hasdata(st,i) ( (st)->end > (st)->start + (i) )
- /// Returns the index of the last data in the stack
- #define script_lastdata(st) ( (st)->end - (st)->start - 1 )
- /// Pushes an int into the stack
- #define script_pushint(st,val) push_val((st)->stack, C_INT, (val))
- /// Pushes a string into the stack (script engine frees it automatically)
- #define script_pushstr(st,val) push_str((st)->stack, C_STR, (val))
- /// Pushes a copy of a string into the stack
- #define script_pushstrcopy(st,val) push_str((st)->stack, C_STR, aStrdup(val))
- /// Pushes a constant string into the stack (must never change or be freed)
- #define script_pushconststr(st,val) push_str((st)->stack, C_CONSTSTR, (val))
- /// Pushes a nil into the stack
- #define script_pushnil(st) push_val((st)->stack, C_NOP, 0)
- /// Pushes a copy of the data in the target index
- #define script_pushcopy(st,i) push_copy((st)->stack, (st)->start + (i))
複製代碼 我再查看script.c時候,發現腳本語法會使用到堆疊,例如 script_pushint(st,0);
但是不懂的是 該如何使用的時機以及用法
能不能舉一些例子 ? |
|