Closed peterbillam closed 7 years ago
Would you mind making a pull request with this? I don't have a Lua development environment set up right now, so I would like to rely on you.
I can't get it working; but the following code works if I also edit ao_example.lua from require("ao") to local ao=require("ao")
lua_newtable(L);
luaL_setfuncs(L, ao, 0);
luaL_register(L, "ao", ao); /\* 5.1 */
BUT: I can't work out how to put table ao into the calling namespace, I've never done it before. See: http://www.lua.org/manual/5.2/manual.html#luaL_setfuncs
Normally, luarocks detects which lua it's running under and installs accordingly. Currently the Makefile has 5.1 hardwired so it'll have to change, though I'm not sure how your rockspec is generated. ( For me, making the rockspec is part of my development cycle, and I've always used build = { type="builtin", ... } )
I get warnings in l_initialize, l_shutdown and l___gc about parameter L being unused, which is true.
Of course if you can generate a rockspec, I will eagerly check that it installs under 5.2 ...
Adding the two lines lua_pushvalue(L, -1); lua_setglobal(L, "ao");
Should restore old behaviour, though of course the reason lua 5.2 changed this is because they want the newer, explicit behaviour.
So everything is working as intended? Can't say I'm very familiar with 5.2.
Hi. I get: /usr/local/lib/lua/5.2/ao.so: undefined symbol: luaL_register which reminds me of a change I had to make in my midialsa.lua
if LUA_VERSION_NUM >= 502
else
endif
YMMV ... Regards, Peter