Trying to run dump(x) macro example from http://lua-users.org/wiki/LuaMacros :
$ lua -lmacro
Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio
> __def 'dump(x) print(_STR(x).." = "..tostring(x))'
stdin:1: attempt to call global '__def' (a nil value)
stack traceback:
stdin:1: in main chunk
[C]: in ?
System: Cygwin x64.
Any ideas of what's wrong with __def? Thanks.
Related
I'm getting this error when trying to require LuaSocket with Lua5.3
error loading module 'socket.core' from file
'/usr/local/lib/lua/5.3/socket/core.so':
/usr/local/lib/lua/5.3/socket/core.so: undefined symbol: luaL_openlib
Console Output with demonstration:
barreeeiroo#Telegram ~/mattata-ai> lua
Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio
> local socket = require("socket.core")
> ^C⏎
barreeeiroo#Telegram ~/mattata-ai> lua5.3
Lua 5.3.3 Copyright (C) 1994-2016 Lua.org, PUC-Rio
> local socket = require("socket.core")
error loading module 'socket.core' from file '/usr/local/lib/lua/5.3/socket/core.so':
/usr/local/lib/lua/5.3/socket/core.so: undefined symbol: luaL_openlib
stack traceback:
[C]: in ?
[C]: in function 'require'
stdin:1: in main chunk
[C]: in ?
> ^C⏎
barreeeiroo#Telegram ~/mattata-ai> readelf -a /usr/bin/lua | grep openlib
109: 0000000000018a70 163 FUNC GLOBAL DEFAULT 15 luaL_openlib##LUA_5.2
240: 0000000000018b20 117 FUNC GLOBAL DEFAULT 15 luaL_openlibs##LUA_5.2
barreeeiroo#Telegram ~/mattata-ai> readelf -a /usr/bin/lua5.3 | grep openlib
238: 000000000001b330 85 FUNC GLOBAL DEFAULT 15 luaL_openlibs##LUA_5.3
How can I make luaL_openlib to work with Lua5.3?
I faced the same issue and solved with this link: https://luarocks.org/
My problem is that I was using lua 5.3 and my luarocks was downloading modules for lua 5.1
I tried this code :
assert(os.setlocale('fr_FR'))
print(12.34)
And it failed.
locale.lua
lua: locale.lua:1: assertion failed!
stack traceback:
[C]: in function 'assert'
locale.lua:1: in main chunk
[C]: in ?
On Ubuntu 14.04, lua -v
Lua 5.2.3 Copyright (C) 1994-2013 Lua.org, PUC-Rio
I'm trying to load the Lua Augeas bindings using the Lua 5.1 standalone interpreter:
$ lua5.1
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> require 'augeas'
error loading module 'augeas' from file '/usr/lib/x86_64-linux-gnu/lua/5.1/augeas.so':
/usr/lib/x86_64-linux-gnu/lua/5.1/augeas.so: undefined symbol: aug_close
stack traceback:
[C]: ?
[C]: in function 'require'
stdin:1: in main chunk
[C]: ?
>
$ nm -D /usr/lib/x86_64-linux-gnu/lua/5.1/augeas.so | grep close
U aug_close
Is there something I'm doing wrong?
The lua-augeas library in Ubuntu is an old version which was not built with the necessary flags to make link it to the Augeas library.
$ lua -v -e "print(os.date('%l'))"
Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio
lua: (command line):1: bad argument #1 to 'date' (invalid conversion specifier '%l')
stack traceback:
[C]: in function 'date'
(command line):1: in main chunk
[C]: in
If so, where am I supposed to submit a bug report?
It's not a bug in Lua. os.date uses format, as described by strftime C function provided by your compiler (I mean the compiler that Lua was compiled with). It is known that some compilers (MSVC, for instance, which just outright crashes when provided with certain patterns) do not provide all patterns.
I tried to follow the example at http://www.keplerproject.org/luasql/examples.html
Lua 5.2.0 Copyright (C) 1994-2011 Lua.org, PUC-Rio
> require "luasql.postgres"
> env = assert (luasql.postgres())
stdin:1: attempt to index global 'luasql' (a nil value)
stack traceback:
stdin:1: in main chunk
[C]: in ?
>
What am I missing?
You could try
luasql = require "luasql.postgres"
env = assert (luasql.postgres())