lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I wish it worked like the Common Lisp REPL, but it's still miles better than not having one...

On 1/7/12 9:30 AM, sduclos wrote:
Ha boys, this is embarrassing :)

Thanks,



On Sat, Jan 7, 2012 at 12:20 PM, Duncan Cross<duncan.cross@gmail.com>  wrote:
On Sat, Jan 7, 2012 at 5:13 PM, sduclos<sduclos.cairo@gmail.com>  wrote:
Hi,

Just to report that LuaJIT-2.0.0 (beta9&  git) work if 'ffi' is not a
'local' variable

The tutorial say:

local ffi = require("ffi")

but a printf(ffi) return 'nil'


However if 'local' is absent ffi work as advertise:

$  ./luajit
LuaJIT 2.0.0-beta9 -- Copyright (C) 2005-2011 Mike Pall. http://luajit.org/
JIT: ON CMOV SSE2 SSE3 AMD fold cse dce fwd dse narrow loop abc fuse
local ffi = require("ffi")
print(ffi)
nil
ffi = require("ffi")
print(ffi)
table: 0x405faf18

...

Every line you write at the interactive prompt is compiled and run as
its own chunk, with its own local variables. This is the same in
standard Lua. Try this at the interactive prompt:

  >  local a = 3
  >  print(a)

It makes local variables when using the interactive prompt pretty
useless in general, at least for single-line stuff.

-Duncan