• Hail, we're RedGuides. We want you to play six (yes, 6!) EverQuest characters at once. We have scripts and a friendly community to help, please join our playstyle and say hello! 👋
  • We've added LLM sections to our Terms & Rules and Resource Rules, for everyone's sanity & in-game safety.
    Read more
    a. Do not replace your voice with an LLM. This goes for your posts and your scripts. Drafting and editing with a tool is fine, but don't take you out of what you share.
    b. Do not replace your EQ character's voice with an LLM. We don't want scripts that speak over /ooc, /shout or other public channels. This has been an unwritten rule that's kept casino scripts off the site for decades, but we're now compelled to make it clear: keep automated communication private.

    Why Does RG Review Scripts?
    Nearly every LLM-written Lua script we see is making your character do impossible things, and rarely in a way that's beneficial to you. We've seen heavy server hammering, /target over impossible distances when /nav spawn would passively accomplish the same thing, a spawn search that fires 20+ times per second, and other pointless actions that are likely annoying GMs.

    You are welcome to use LLMs as a tool to structure, draft, and edit your work, but please read critically before hitting /lua run

Lua - Require filepath tip and implementation

Hardcoding your Lua project name (package) into require statements can make it difficult to update filepaths and cause the module finder to not find your libs.

You can avoid hardcoding your Lua project / package name into your requires using the following example:

local _PACKAGE = (...):match("^(.+)[%./][^%./]+") or ""
require(_PACKAGE..'lib/mylib')

Likewise, if you have another directory level to traverse in a lib file, you can repeat the sequence above. In this way you can freely embed nested requires without having to type them out and correct them should they change. This is useful when comparing multiple versions of the code.

The solution to this issue, which is getting into the Lua code here, was gleaned from: https://github.com/tanema/behaviourtree.lua/blob/master/lib/behaviour_tree.lua
 
Last edited:
I tried setting search paths, but the libs weren't found unless I specified the top level directory.

I think the issue was that acc. to what I read about Lua, the preferred method to require libs was to use object notation rather than filepath. I tried both and for some reason it wouldn't work. When I look at lootly, everything looks fine, so I'm confused.

For example. Given this file structure,

Lua
myproject
init.Lua
lib
mylib.Lua

Start in EQ chatwindow: /Lua run myproject/init

init.Lua would then require('lib.mylib')

Unless I added "myproject", require ('myproject.lib.mylib') mylib.Lua wouldn't be found.

I'm a neophyte.
 
Lua - Require filepath tip and implementation

Users who are viewing this thread

Back
Top
Cart