Ok, so when i used MUSH i had all of my scripts in a folder, and set my working directory to that folder so that I could
require "file"
and it would load that script.
Now I'm on mudlet with linux... any tips on replicating this?
External Scripts
Re: External Scripts
The recommended way is to use dofile( getMudletHomeDir().."/scripts/yourscript.lua" ).
Mudlet home dir will get you the currently loaded profile directory. Currently, this is linked to the user's system home directory + .config/mudlet/profiles + profile name. In the near future this will be configurable by the user to make entirely self contained installs possible in order to install Mudlet on a flash drive.
Mudlet home dir will get you the currently loaded profile directory. Currently, this is linked to the user's system home directory + .config/mudlet/profiles + profile name. In the near future this will be configurable by the user to make entirely self contained installs possible in order to install Mudlet on a flash drive.
Re: External Scripts
Hello, Heiko.
I've tried using your method, among others for loading a script from the profile script directory (that I created), and Mudlet throws errors at me for not finding the file.
I know the file exists, its just a one function'r to test the 'require' method.
The code I'm using in the Mudlet script dialog is:
I've tried using your method, among others for loading a script from the profile script directory (that I created), and Mudlet throws errors at me for not finding the file.
Code: Select all
Lua syntax error:[string "require(getMudletHomeDir() .. "/scripts/dic..."]:1: module '/home/chris/.
config/mudlet/profiles/Rakon/scripts/dict.lua' not found:
no field package.preload['/home/chris/.config/mudlet/profiles/Rakon/scripts/dict.lua']
no file './/home/chris//config/mudlet/profiles/Rakon/scripts/dict/lua.lua'
no file '/usr/local/share/lua/5.1//home/chris//config/mudlet/profiles/Rakon/scripts/dict/lua.lua'
no file '/usr/local/share/lua/5.1//home/chris//config/mudlet/profiles/Rakon/scripts/dict/lua/init.
lua'
no file '/usr/local/lib/lua/5.1//home/chris//config/mudlet/profiles/Rakon/scripts/dict/lua.lua'
no file '/usr/local/lib/lua/5.1//home/chris//config/mudlet/profiles/Rakon/scripts/dict/lua/init.
lua'
no file '/usr/share/lua/5.1//home/chris//config/mudlet/profiles/Rakon/scripts/dict/lua.lua'
no file '/usr/share/lua/5.1//home/chris//config/mudlet/profiles/Rakon/scripts/dict/lua/init.lua'
no file './/home/chris//config/mudlet/profiles/Rakon/scripts/dict/lua.so'
no file '/usr/local/lib/lua/5.1//home/chris//config/mudlet/profiles/Rakon/scripts/dict/lua.so'
no file '/usr/lib/lua/5.1//home/chris//config/mudlet/profiles/Rakon/scripts/dict/lua.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file './/home/chris/.so'
no file '/usr/local/lib/lua/5.1//home/chris/.so'
no file '/usr/lib/lua/5.1//home/chris/.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
ERROR: Lua compile error. compiling script of script:Main
Code: Select all
chris@ubutop:~/.config/mudlet/profiles/Rakon/scripts$ ls
dict.lua
Code: Select all
require(getMudletHomeDir() .. "/scripts/dict.lua")
Re: External Scripts
My error. Require doesn't accept absolute pathes.
You'll need to use dofile() directly like this:
You'll need to use dofile() directly like this:
Code: Select all
dofile( getMudletHomeDir() .. "/scripts/test.lua" )