Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

勘误 #3

Open
ctx2002 opened this issue Sep 12, 2023 · 2 comments
Open

勘误 #3

ctx2002 opened this issue Sep 12, 2023 · 2 comments

Comments

@ctx2002
Copy link

ctx2002 commented Sep 12, 2023

页20, 倒数第三段

#define LUA_TNUMFLT (LUA_NUMBER | (0 << 4)) /浮点型/
#define LUA_TNUMINT (LUA_NUMBER | (1 << 4)) /整型/

这个定义与common/luaobject.h中的定义真好相反。

// lua number type
#define LUA_NUMINT (LUA_TNUMBER | (0 << 4))
#define LUA_NUMFLT (LUA_TNUMBER | (1 << 4))

页20, 倒数第二段。

当TValue中的类型是LUA_NUMFLT 时,TValue中的f域将被赋值。
这里的“f域”因该是“n”域吧?

页24, 例2-1

17 lua_pcall(L, 2, 1, 0)
找不到这个函数, 是不是因该改成luaL_pcall?

我看到你这本书上好几个地方都用到了lua_pcall 函数,是不是都应该,改为luaL_pcall?

@izyForever
Copy link

lua_pcall exists. It is the entry point of the c-level safe call lua function in the lua source code, but there is no defind in the author's accompanying code.

@Manistein
Copy link
Owner

“页20, 倒数第三段

#define LUA_TNUMFLT (LUA_NUMBER | (0 << 4)) /浮点型/
#define LUA_TNUMINT (LUA_NUMBER | (1 << 4)) /整型/

这个定义与common/luaobject.h中的定义真好相反。

// lua number type
#define LUA_NUMINT (LUA_TNUMBER | (0 << 4))
#define LUA_NUMFLT (LUA_TNUMBER | (1 << 4))”
已收录。

“页20, 倒数第二段。

当TValue中的类型是LUA_NUMFLT 时,TValue中的f域将被赋值。
这里的“f域”因该是“n”域吧?”是n域,此处是笔误,f域是light c function。

lua_pcall是官方的,dummylua改成放到辅助库里所以加了L,实际上指的是lua_pcall的逻辑。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants