Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lua代码不';t编译“;尝试索引全局';位';(无价值)“;_Lua - Fatal编程技术网

Lua代码不';t编译“;尝试索引全局';位';(无价值)“;

Lua代码不';t编译“;尝试索引全局';位';(无价值)“;,lua,Lua,为什么这两行Lua代码不能编译?编译器显示错误“尝试索引全局“位”(一个nil值)” 很可能您使用了错误的Lua版本,没有bit库。哪个版本有bit库?我在Ubuntu上试过5.2和5.1。我需要单独安装库吗?它是bit32,用于5.2功能bit。brshift仅在ComputerCraft中实现。可能,您正试图在另一种Lua方言中使用此函数。在vanilla Lua 5.2中有bit32.rshift,在vanilla Lua 5.3中有操作符>,在LuaJIT中有位。rshift很可能使用了

为什么这两行Lua代码不能编译?编译器显示错误“尝试索引全局“位”(一个nil值)”


很可能您使用了错误的Lua版本,没有
bit
库。哪个版本有bit库?我在Ubuntu上试过5.2和5.1。我需要单独安装库吗?它是
bit32
,用于5.2功能
bit。brshift
仅在ComputerCraft中实现。可能,您正试图在另一种Lua方言中使用此函数。在vanilla Lua 5.2中有
bit32.rshift
,在vanilla Lua 5.3中有操作符
>
,在LuaJIT中有
位。rshift
很可能使用了错误的Lua版本,没有
库。哪个版本有位库?我在Ubuntu上试过5.2和5.1。我需要单独安装库吗?它是
bit32
,用于5.2功能
bit。brshift
仅在ComputerCraft中实现。可能,您正试图在另一种Lua方言中使用此函数。在vanilla Lua 5.2中有
位32.rshift
,在vanilla Lua 5.3中有运算符
>
,在LuaJIT中有
位.rshift
local rshift = bit.brshift
local lshift = bit.blshift