Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Koneki » unpack and table.unpack for Lua 5.2
unpack and table.unpack for Lua 5.2 [message #1417037] Fri, 13 December 2013 19:07 Go to next message
nidal pres is currently offline nidal presFriend
Messages: 4
Registered: December 2013
Junior Member
I have just started using Koneki and have created new project and selected Lua 5.2 as a targeted execution environment.
All is fine for now, only when I use table.unpack() in my code I get this exception:

main.lua:31: attempt to call field 'unpack' (a nil value)

However, code completion shows unpack when I type table<dot> and when I hover with mouse over unpack() in table.unpack() it shows doc entry for table.unpack().

Changing table.unpack() with just unpack() does not create an exception.

Code that doesn't work:

function unpackit(tt)
table.unpack(tt)
for k,v in ipairs(tt) do
print (k, type(v))
end
end


and code that works:


function unpackit(tt)
unpack(tt)
for k,v in ipairs(tt) do
print (k, type(v))
end
end


So, is my project using 5.2 or 5.1?

Thanks!
Re: unpack and table.unpack for Lua 5.2 [message #1417038 is a reply to message #1417037] Mon, 16 December 2013 10:14 Go to previous messageGo to next message
Marc Aubry is currently offline Marc AubryFriend
Messages: 76
Registered: July 2009
Member
Hi Nidal,

As you used the Lua5.2 Execution Environment, your code is Lua5.2 compatible.
But, it seems you used a Lua5.1 interpreter to run your code (see how LDT manage interpreters in the documentationhttps://wiki.eclipse.org/Koneki/LDT/Developer_Area/User_Guides/User_Guide_1.1#Interpreters). The interpreter by default is JNLua5.1, you can change it in the Launch Configuration as explained in the documentationhttps://wiki.eclipse.org/Koneki/LDT/Developer_Area/User_Guides/User_Guide_1.1#Local_session.

[1]https://wiki.eclipse.org/Koneki/LDT/Developer_Area/User_Guides/User_Guide_1.1#Interpreters
[2]https://wiki.eclipse.org/Koneki/LDT/Developer_Area/User_Guides/User_Guide_1.1#Local_session
Re: unpack and table.unpack for Lua 5.2 [message #1417039 is a reply to message #1417038] Mon, 16 December 2013 16:31 Go to previous messageGo to next message
nidal pres is currently offline nidal presFriend
Messages: 4
Registered: December 2013
Junior Member
Oh, I see. I went on to Preferences->Lua->Execution Environments and ticked check box next to Lua 5.2, what I should have done is go to Preferences->Lua->Interpreters and tick check box next to Lua 5.2 there.

Now it works! :)

Thanks!
Re: unpack and table.unpack for Lua 5.2 [message #1417040 is a reply to message #1417039] Tue, 17 December 2013 16:17 Go to previous message
Marc Aubry is currently offline Marc AubryFriend
Messages: 76
Registered: July 2009
Member
Just found an enhancement have been filed to set the Lua5.2 interperter by default while using Lua5.2 Execution Environment, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=397470.
Previous Topic:LDT 1.1RC2 and LuaDocumentor 1.13 are out.
Next Topic:Koneki LDT plugins
Goto Forum:
  


Current Time: Mon Nov 12 18:51:19 GMT 2018

Powered by FUDForum. Page generated in 0.02571 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top