我按照这里的说明,用Mingw从头开始设置Lua和Luarocks.一切都很好,我能够安装岩石,包括需要像LuaSocket一样编译的岩石.
我按照Torch7页面上的说明通过luarocks安装Torch.但它失败了.我不懂为什么.
这是控制台输出.我最好的猜测是它与Building for: Visual Studio 9 2008
我想要使用Mingw时有关.
PS C:\WINDOWS\system32> luarocks --server=https://raw.githubusercontent.com/torch/rocks/master install torch
Installing https://raw.githubusercontent.com/torch/rocks/master/torch-scm-1.rockspec...
Using https://raw.githubusercontent.com/torch/rocks/master/torch-scm-1.rockspec... switching to 'build' mode
Missing dependencies for torch:
paths >= 1.0
cwrap >= 1.0
Using https://raw.githubusercontent.com/torch/rocks/master/paths-scm-1.rockspec... switching to 'build' mode
Cloning into 'paths'...
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 10 (delta 0), reused 6 (delta 0)R
Receiving objects: 100% (10/10), 12.24 KiB | 0 bytes/s, done.
Checking connectivity... done. …
Run Code Online (Sandbox Code Playgroud) 我不知道这是Lua本身的错误还是我做错了什么.我无论如何都找不到任何关于它的东西.我正在使用Lua for Windows(Lua 5.1.4):
>return math.random(0, 1000000000)
1251258
Run Code Online (Sandbox Code Playgroud)
这将返回0到10000000000之间的随机整数,如预期的那样.这似乎适用于所有其他值.但如果我添加一个0:
>return math.random(0, 10000000000)
stdin:1: bad argument #2 to 'random' (interval is empty)
Run Code Online (Sandbox Code Playgroud)
任何高于此数字的数字都是相同的.
我试图弄清楚一个数字必须有多高才能导致这种情况发现甚至更奇怪的事情:
>return math.random(0, 2147483647)
-75617745
Run Code Online (Sandbox Code Playgroud)
如果值是2147483647那么它给出了负数.任何高于此值,它会抛出一个错误.任何低于它,它工作正常.
这是0b1111111111111111111111111111111
二进制的,完全是31位二进制数字.我不确定这意味着什么.
在Chrome中,我首先使用AudioContext创建连续音:
var audioCtx = new (window.AudioContext || window.webkitAudioContext);
var oscillator = audioCtx.createOscillator();
var gainNode = audioCtx.createGain();
oscillator.connect(gainNode);
gainNode.connect(audioCtx.destination);
oscillator.start();
Run Code Online (Sandbox Code Playgroud)
现在我想在几毫秒后停止它.所以我这样做:
setTimeout(oscillator.stop, 500)
Run Code Online (Sandbox Code Playgroud)
这将返回错误Uncaught TypeError: Illegal invocation
.
但是,如果我这样做;
setTimeout(function(){oscillator.stop()}, 500)
Run Code Online (Sandbox Code Playgroud)
它工作正常.
我想现在为什么第一个不起作用并返回错误.这似乎是直截了当的方式.