[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: LuaJIT vs require() on dumb C modules
- From: "Alexander Gladysh" <agladysh@...>
- Date: Mon, 19 May 2008 00:18:11 +0400
Hi, list!
I'm trying to load minimal C module with LuaJIT:
LUALIB_API int luaopen_mod(lua_State * L)
{
lua_newtable(L);
lua_pushcfunction(L, Lhi);
lua_setfield(L, -2, "hi");
return 1;
}
local mod = require("mod")
This works with plain Lua, but doesn't with LuaJIT. In LuaJIT that
require() call returns true instead of my module's table. Am I missing
something?
$ /usr/local/bin/lua -v
Lua 5.1.3 Copyright (C) 1994-2008 Lua.org, PUC-Rio
$ luajit -v
Lua 5.1.3 Copyright (C) 1994-2008 Lua.org, PUC-Rio
LuaJIT 1.1.4 Copyright (C) 2005-2008 Mike Pall, http://luajit.org/
$ make clean
$ make
$ /usr/local/bin/lua test.lua
OK
$ luajit -O test.lua
luajit: test.lua:2: not a table
stack traceback:
[C]: in function 'assert'
test.lua:2: in main chunk
[C]: ?
$ luajit -O0 test.lua
luajit: test.lua:2: not a table
stack traceback:
[C]: in function 'assert'
test.lua:2: in main chunk
[C]: ?
Minimal example attached.
Thanks in advance,
Alexander.
Attachment:
example.tar.gz
Description: GNU Zip compressed data