[OTClient] How to add new lua libraries?

Togu

Active Member
Joined
Jun 22, 2018
Messages
300
Best answers
1
Reaction score
141
Location
Brazil
So, I want to create a button on client that download a file from internet, I need the "socket" library for that, I tried using socker = require("socket") on terminal on cliente but received:
Code:
ERROR: command failed: :1: module 'socket' not found:
    no module 'socket'
    no field package.preload['socket']
    no file '.\socket.lua'
    no file 'G:\OneDrive\Projetos\OpenTibia\TheForgottenTibia\Client\lua\socket.lua'
    no file 'G:\OneDrive\Projetos\OpenTibia\TheForgottenTibia\Client\lua\socket\init.lua'
    no file '.\socket.dll'
    no file 'G:\OneDrive\Projetos\OpenTibia\TheForgottenTibia\Client\socket.dll'
    no file 'G:\OneDrive\Projetos\OpenTibia\TheForgottenTibia\Client\loadall.dll'
    unable to open file '/socket.lua': O sistema não pode encontrar o arquivo especificado.
 

drakylucas

Active Member
Joined
Dec 15, 2015
Messages
118
Best answers
1
Reaction score
42
I'm not sure, but is this module in the folder client/lua?
I don't know if there's a package manager (npm, yarn, etc) for lua,but I think no
 

zxmatzx

Intermediate OT User
Joined
Dec 1, 2010
Messages
159
Best answers
6
Reaction score
41
So, I want to create a button on client that download a file from internet, I need the "socket" library for that, I tried using socker = require("socket") on terminal on cliente but received:
Code:
ERROR: command failed: :1: module 'socket' not found:
    no module 'socket'
    no field package.preload['socket']
    no file '.\socket.lua'
    no file 'G:\OneDrive\Projetos\OpenTibia\TheForgottenTibia\Client\lua\socket.lua'
    no file 'G:\OneDrive\Projetos\OpenTibia\TheForgottenTibia\Client\lua\socket\init.lua'
    no file '.\socket.dll'
    no file 'G:\OneDrive\Projetos\OpenTibia\TheForgottenTibia\Client\socket.dll'
    no file 'G:\OneDrive\Projetos\OpenTibia\TheForgottenTibia\Client\loadall.dll'
    unable to open file '/socket.lua': O sistema não pode encontrar o arquivo especificado.
Hi,
I created lua folder in OTC master folder, and put my libary myLibName.lua inside, then just used require("myLibName") in my .lua module file and accessed the libary functions.

Any problem, u can PM me, i can help you.
Hope works.
 
OP
Togu

Togu

Active Member
Joined
Jun 22, 2018
Messages
300
Best answers
1
Reaction score
141
Location
Brazil
Niceeeee, I was going to ask this now... "where to include the files of the socket library" hahahah
I'm gonna try! Thanks!
 

zxmatzx

Intermediate OT User
Joined
Dec 1, 2010
Messages
159
Best answers
6
Reaction score
41
Niceeeee, I was going to ask this now... "where to include the files of the socket library" hahahah
I'm gonna try! Thanks!
You can put the libary(.lua or .dll i guess, only tested with .lua) in the lua folder, and then require to use.
Let me know if worked.
 
OP
Togu

Togu

Active Member
Joined
Jun 22, 2018
Messages
300
Best answers
1
Reaction score
141
Location
Brazil
Loool
Copy and paste that on lua terminal: os.execute("start http://reaper.fm")
It totally fits my needs haha
 
OP
Togu

Togu

Active Member
Joined
Jun 22, 2018
Messages
300
Best answers
1
Reaction score
141
Location
Brazil
Hi,
I created lua folder in OTC master folder, and put my libary myLibName.lua inside, then just used require("myLibName") in my .lua module file and accessed the libary functions.

Any problem, u can PM me, i can help you.
Hope works.
Worked for a simple file but not for the lua socket lib :/

ERROR: command failed: ...ojetos\OpenTibia\TheForgottenTibia\Client\lua\socket.lua:12: module 'socket.core' not found:
no module 'socket.core'
no field package.preload['socket.core']
no file '.\socket\core.lua'
no file 'G:\OneDrive\Projetos\OpenTibia\TheForgottenTibia\Client\lua\socket\core.lua'
no file 'G:\OneDrive\Projetos\OpenTibia\TheForgottenTibia\Client\lua\socket\core\init.lua'
no file '.\socket\core.dll'
no file 'G:\OneDrive\Projetos\OpenTibia\TheForgottenTibia\Client\socket\core.dll'
no file 'G:\OneDrive\Projetos\OpenTibia\TheForgottenTibia\Client\loadall.dll'
no file '.\socket.dll'
no file 'G:\OneDrive\Projetos\OpenTibia\TheForgottenTibia\Client\socket.dll'
no file 'G:\OneDrive\Projetos\OpenTibia\TheForgottenTibia\Client\loadall.dll'
 
Top