diff options
author | David Walter Seikel | 2012-01-25 02:29:35 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-25 02:29:35 +1000 |
commit | 3236320311f15640083c5bf420bcdeab725ff242 (patch) | |
tree | 7f8abdafad10884fbdedf919e49c8b79c1f2287b /LuaSL/testLua/luaprocTest1_C.lua | |
parent | Quick and dirty testing of luaJIT+luaproc from LuaSL. (diff) | |
download | SledjHamr-3236320311f15640083c5bf420bcdeab725ff242.zip SledjHamr-3236320311f15640083c5bf420bcdeab725ff242.tar.gz SledjHamr-3236320311f15640083c5bf420bcdeab725ff242.tar.bz2 SledjHamr-3236320311f15640083c5bf420bcdeab725ff242.tar.xz |
Hack together LuaSL, LuaJIT, and luaproc. It's frankenstein right now. lol
Diffstat (limited to '')
-rw-r--r-- | LuaSL/testLua/luaprocTest1_C.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/LuaSL/testLua/luaprocTest1_C.lua b/LuaSL/testLua/luaprocTest1_C.lua new file mode 100644 index 0000000..61cb461 --- /dev/null +++ b/LuaSL/testLua/luaprocTest1_C.lua | |||
@@ -0,0 +1,28 @@ | |||
1 | result, error_msg = luaproc.newproc( [=[ | ||
2 | |||
3 | local count = 0 | ||
4 | |||
5 | -- Hmm, luajit 2 beta 9 crashes at about 8140, lua can go up to 50000 at least. | ||
6 | for i = 1, 8000 do | ||
7 | local channel = "channel" .. i | ||
8 | -- local proc = 'print(luaproc.receive("channel' .. i .. '") .. " " .. ' .. i ..')' | ||
9 | local proc = 'luaproc.receive("' .. channel .. '")' | ||
10 | |||
11 | -- print(channel .. "\n" .. proc) | ||
12 | result, error_msg = luaproc.newchannel(channel) | ||
13 | if not result then print(error_msg) end | ||
14 | result, error_msg = luaproc.newproc(proc) | ||
15 | if not result then print(error_msg) else count = count + 1 end | ||
16 | end | ||
17 | |||
18 | print("Started " .. count .. " Lua threads") | ||
19 | |||
20 | if 0 ~= count then | ||
21 | for i = 1, count do | ||
22 | result, error_msg = luaproc.send("channel" .. i, 'luaproc is working fine! ' .. i) | ||
23 | if not result then print(error_msg .. " " .. i) end | ||
24 | end | ||
25 | end | ||
26 | ]=] ) | ||
27 | if not result then print(error_msg .. " for main proc") end | ||
28 | |||