diff options
| author | Li Jin <dragon-fly@qq.com> | 2021-03-03 21:31:01 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2021-03-03 21:33:37 +0800 |
| commit | 1df786307c1983b8ce693e3916081a8bcd4e95ae (patch) | |
| tree | 6c7aeb2198d825877fd3d179c394b7a5c1f06a17 /src/lua/lauxlib.h | |
| parent | 66168b112b707172b9035edf8c1daed469781e06 (diff) | |
| download | yuescript-1df786307c1983b8ce693e3916081a8bcd4e95ae.tar.gz yuescript-1df786307c1983b8ce693e3916081a8bcd4e95ae.tar.bz2 yuescript-1df786307c1983b8ce693e3916081a8bcd4e95ae.zip | |
add new metatable syntax for issue #41, fix reusing local variable issue, update built-in Lua.
Diffstat (limited to '')
| -rw-r--r-- | src/lua/lauxlib.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lua/lauxlib.h b/src/lua/lauxlib.h index 6571491..9058e26 100644 --- a/src/lua/lauxlib.h +++ b/src/lua/lauxlib.h | |||
| @@ -122,6 +122,10 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, | |||
| 122 | ** =============================================================== | 122 | ** =============================================================== |
| 123 | */ | 123 | */ |
| 124 | 124 | ||
| 125 | #if !defined(l_likely) | ||
| 126 | #define l_likely(x) x | ||
| 127 | #endif | ||
| 128 | |||
| 125 | 129 | ||
| 126 | #define luaL_newlibtable(L,l) \ | 130 | #define luaL_newlibtable(L,l) \ |
| 127 | lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1) | 131 | lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1) |
| @@ -130,10 +134,10 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, | |||
| 130 | (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0)) | 134 | (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0)) |
| 131 | 135 | ||
| 132 | #define luaL_argcheck(L, cond,arg,extramsg) \ | 136 | #define luaL_argcheck(L, cond,arg,extramsg) \ |
| 133 | ((void)((cond) || luaL_argerror(L, (arg), (extramsg)))) | 137 | ((void)(l_likely(cond) || luaL_argerror(L, (arg), (extramsg)))) |
| 134 | 138 | ||
| 135 | #define luaL_argexpected(L,cond,arg,tname) \ | 139 | #define luaL_argexpected(L,cond,arg,tname) \ |
| 136 | ((void)((cond) || luaL_typeerror(L, (arg), (tname)))) | 140 | ((void)(l_likely(cond) || luaL_typeerror(L, (arg), (tname)))) |
| 137 | 141 | ||
| 138 | #define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) | 142 | #define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) |
| 139 | #define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) | 143 | #define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) |
