• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[OTClient] How to add new lua libraries?

Togu

Advanced OT User
Joined
Jun 22, 2018
Messages
308
Solutions
1
Reaction score
178
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.
 
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
 
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.
 
Niceeeee, I was going to ask this now... "where to include the files of the socket library" hahahah
I'm gonna try! Thanks!
 
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.
 
Loool
Copy and paste that on lua terminal: os.execute("start http://reaper.fm")
It totally fits my needs haha
 
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'
 
Back
Top