Giter Club home page Giter Club logo

Comments (17)

cpu avatar cpu commented on July 16, 2024 1

Thanks for the report! I will take a look shortly

from blightspell.

abesto avatar abesto commented on July 16, 2024 1

Hm, this should be fine.

if store.disk_read(plugin_name) == nil then
  blightspell_defaults_init()
end

from blightspell.

cpu avatar cpu commented on July 16, 2024 1

I think I might have been able to reproduce by first installing the blightmud_mcp plugin.

Let me see if I can puzzle out what's going on here. IIRC the way I'm handling settings was heavily inspired by Lisdude's work, it's possible there's an unplanned interaction between the two.

from blightspell.

abesto avatar abesto commented on July 16, 2024 1

Yeah I can imagine blightmud is running a single Lua interpreter that optimizes out duplicate loads of "the same module"

from blightspell.

cpu avatar cpu commented on July 16, 2024 1

Renaming settings.lua and the require in Blightspell did the trick.

I'll open a PR in a moment that prefixes all of the require'd files to avoid this. This kind of thing is one of the reasons I don't particluarly love Lua ๐Ÿ˜†

from blightspell.

abesto avatar abesto commented on July 16, 2024 1

Confirm I now have working spell checking after /update_plugins!

from blightspell.

cpu avatar cpu commented on July 16, 2024 1

Confirm I now have working spell checking after /update_plugins!

Awesome. Glad to hear it. Thanks for your help getting to the bottom of this. It was pretty mysterious.

The interpreter thinks this all plugins are in one shared source tree :( Want me to file the issue on Blightmud?

Sure, it might be helpful to at least communicate the problem exists. I suspect other plugin authors will bump into this sooner or later. Perhaps there's a fix that could be landed on that side (though I'm unlikely to have the time to pursue it myself).

from blightspell.

cpu avatar cpu commented on July 16, 2024

@abesto So far I'm not able to reproduce ๐Ÿค”

Blightmud on ๎‚  cpu-blightspell-6_impl [$?] is ๐Ÿ“ฆ v5.4.0 via ๐Ÿฆ€ v1.79.0-nightly via โ„๏ธ  impure (nix-shell-env)
โฏ cargo build --release
<snipped>

Blightmud on ๎‚  cpu-blightspell-6_impl [$?] is ๐Ÿ“ฆ v5.4.0 via ๐Ÿฆ€ v1.79.0-nightly via โ„๏ธ  impure (nix-shell-env)
โฏ mv ~/.config/blightmud/ ~/.config/blightmud.old

Blightmud on ๎‚  cpu-blightspell-6_impl [$?] is ๐Ÿ“ฆ v5.4.0 via ๐Ÿฆ€ v1.79.0-nightly via โ„๏ธ  impure (nix-shell-env)
โฏ mv ~/.local/share/blightmud/ ~/.local/share/blightmud.old

โฏ ./target/release/blightmud
โ”„Welcome

Blightmud 5.4.0 (v5.3.0-238-g6858349)

Created by: Linus Probert

Visit https://github.com/Blightmud/blightmud for latest information, bug reports and source code.

Type /connect <host> <port> to connect to a mud Type /help for more options

โ”„โ”„Changes

See /help changes to see what has changed in the latest major release.
> /add_plugin https://github.com/cpu/blightspell
[**] Downloading plugin: blightspell from https://github.com/cpu/blightspell
[**] Downloaded plugin: blightspell
[**] Getting the submodules for blightspell.
[**] Plugin retrieval succeeded.
> /load_plugin blightspell
[plugin] Loading: blightspell
[**] Loaded script: /home/daniel/.local/share/blightmud/plugins/blightspell/main.lua
[blightspell] spellchecking language: en
[blightspell] spellchecking enabled

Is there anything interesting in your ~/.local/share/blightmud/store/data.ron file? Are you running this on Linux, macOS, or another platform?

from blightspell.

abesto avatar abesto commented on July 16, 2024

Huh, then it must be something in my env.

cat ~/.local/share/blightmud/store/data.ron
{"mcp_settings":"{\"lambdamoo_connect_string\":\"\\\\*\\\\*\\\\* Connected \\\\*\\\\*\\\\*\",\"simpleedit_path\":\"/home/abesto/.local/share/blightmud/plugins/blightmud_mcpsimpleedit/\",\"debug_mcp\":false,\"stat_command\":\"stat\",\"simpleedit_timeout\":10800,\"edit_command\":\"code \\\"%FILE\\\"\"}"}

This is running on Arch under WSL (I like pain, what can I say)

Tried a clean build, just in case:

$ git clone https://github.com/Blightmud/Blightmud.git
Cloning into 'Blightmud'...
--- %< ---
Resolving deltas: 100% (5834/5834), done.
$ cd blightmud
$ cargo build --release
--- %< ---
    Finished `release` profile [optimized] target(s) in 2m 27s 

load_plugin then does give some useful output (I guess the build from AUR must have some optimizations enabled or something):

[!!] [Lua] Script error:
[!!]    runtime error: .../.local/share/blightmud/plugins/blightspell/src/init.lua:8: attempt to index a nil value (global 'blightspell_settings')
[!!]    stack traceback:
[!!]            [C]: in metamethod 'index'
[!!]            .../.local/share/blightmud/plugins/blightspell/src/init.lua:8: in function 'blightspell_init'
[!!]            .../.local/share/blightmud/plugins/blightspell/src/init.lua:30: in main chunk
[!!]            [C]: in function 'require'
[!!]            [string "/home/abesto/.local/share/blightmud/plugins/b..."]:21: in main chunk

from blightspell.

abesto avatar abesto commented on July 16, 2024

At first glance: blighspell might assume that if there's a config file, then it must also contain a blightspell key?

from blightspell.

cpu avatar cpu commented on July 16, 2024

This is running on Arch under WSL (I like pain, what can I say)

๐Ÿ˜†

load_plugin then does give some useful output (I guess the build from AUR must have some optimizations enabled or something):

That is helpful, thank you!

At first glance: blighspell might assume that if there's a config file, then it must also contain a blightspell key?

It does seem related to the settings init, but I thought the defaults would be written if the blightspell key weren't present:

-- Store defaults on first run.
if store.disk_read(plugin_name) == nil then
blightspell_defaults_init()
end

Edit: looks like we both arrived at that conclusion :-)

from blightspell.

abesto avatar abesto commented on July 16, 2024

Gotta check on something else, but after poking a bit, it seems like settings.lua is not loaded at all for me? Is that possible?

from blightspell.

cpu avatar cpu commented on July 16, 2024

it seems like settings.lua is not loaded at all for me? Is that possible?

It should be loaded first in main.lua:

blightspell/main.lua

Lines 17 to 21 in b80cbe3

require("src/settings")
require("src/spellcheck")
require("src/listeners")
require("src/bindings")
require("src/init")

from blightspell.

abesto avatar abesto commented on July 16, 2024

It should be loaded first in main.lua

Right, then I must be holding it wrong. I'll try again.

from blightspell.

abesto avatar abesto commented on July 16, 2024

This is weird as hell. I added debug blight.output calls before the src/settings require, after it, and inside the file at the top. Have output before, have output after, but don't have output inside.

from blightspell.

cpu avatar cpu commented on July 16, 2024

I wonder if it's as simple as using the same settings.lua name and having a conflict with the require path resolution:
https://github.com/lisdude/blightmud_mcp/blob/9661b75abbe890487c8e0daca1dcfb131c3658ca/main.lua#L9

That seems like it would match your observation of the missing output from Blightspell's src/settings - my theory is that require is loading the blightmud_mcp settings.lua instead.

from blightspell.

abesto avatar abesto commented on July 16, 2024

Right, this seems like a problem with how Blightmud executes Lua then. The interpreter thinks this all plugins are in one shared source tree :( Want me to file the issue on Blightmud?

Thank you for putting in a workaround! :D

from blightspell.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.