summaryrefslogtreecommitdiff
path: root/src/lua51/lcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua51/lcode.c')
-rw-r--r--src/lua51/lcode.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lua51/lcode.c b/src/lua51/lcode.c
index e1da87b..8f25b06 100644
--- a/src/lua51/lcode.c
+++ b/src/lua51/lcode.c
@@ -226,6 +226,7 @@ static void freeexp (FuncState *fs, expdesc *e) {
}
+//c 设置常量表
static int addk (FuncState *fs, TValue *k, TValue *v) {
lua_State *L = fs->L;
TValue *idx = luaH_set(L, fs->h, k);
@@ -247,13 +248,15 @@ static int addk (FuncState *fs, TValue *k, TValue *v) {
}
+//c 设置常量字符串
int luaK_stringK (FuncState *fs, TString *s) {
TValue o;
- setsvalue(fs->L, &o, s);
+ setsvalue(fs->L, &o, s); //c o.value.gc = s; o.tt=LUA_TSTRING
return addk(fs, &o, &o);
}
+//c 设置常量数字
int luaK_numberK (FuncState *fs, lua_Number r) {
TValue o;
setnvalue(&o, r);
@@ -261,6 +264,7 @@ int luaK_numberK (FuncState *fs, lua_Number r) {
}
+//c 设置常量bool值
static int boolK (FuncState *fs, int b) {
TValue o;
setbvalue(&o, b);
@@ -268,6 +272,7 @@ static int boolK (FuncState *fs, int b) {
}
+//c 设置常量nil
static int nilK (FuncState *fs) {
TValue k, v;
setnilvalue(&v);