require() doesn't work with lua scripts
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

require() doesn't work with lua scripts

Started by ATAG, 24 July, 2009, 19:01:16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ATAG

When i try to load a lua module (written in lua) i get this error:
Quote24.07.2009 18:49:16 - error loading module 'vhsql' from file '/home/atag/.PtokaX/libs/vhsql.lua':

   /home/atag/.PtokaX/libs/vhsql.lua: invalid ELF header

This is only PtokaX related problem, in lua commandline it works like a charm.

I can' use dofile() because this module uses a global sqlite db for all scripts :(

Version: PtokaX DC Hub 0.4.1.1 built on Jul 24 2009 18:40:37
OS: Linux 2.6.28-14-generic (i686) -> (Ubuntu 9.04)

PPK

PtokaX on unix not contains lua and not change any default lua functions :o
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

ATAG

#2
Hmm.. i tried to compile PX with lua-5.1.4 (from source) but i got this:
Quote/usr/local/lib/liblua.a(loadlib.o): In function `ll_loadfunc':
loadlib.c:(.text+0xa31): undefined reference to `dlsym'
loadlib.c:(.text+0xa7c): undefined reference to `dlopen'
loadlib.c:(.text+0xa89): undefined reference to `dlerror'
loadlib.c:(.text+0xaa1): undefined reference to `dlerror'
/usr/local/lib/liblua.a(loadlib.o): In function `gctm':
loadlib.c:(.text+0x109e): undefined reference to `dlclose'
collect2: ld returned 1 exit status
make: *** [PtokaX] Error 1
atag@server:~/PtokaX$
Any idea? :(




Sorry, i've found the solution here.

Now i get the "ivalid ELF header" error in commandline too :D




Ok, finally i found the problem. We have to add libs folder to package.path TOO
if not string.find(package.path, Core.GetPtokaXPath().."libs/?.lua", 1, 1) then
package.path = package.path..";"..Core.GetPtokaXPath().."libs/?.lua"
end

PPK

Good, nice to see that you fixed it yourself  8)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

SMF spam blocked by CleanTalk