ryanhaney97 / forge-clj

A WIP implementation of clojure for minecraft forge.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Lua API

Immortalin opened this issue · comments

commented

Hi, can you add a Lua API for building mod integrations with computercraft/opencc?

You mean, like, make it so that you can write computercraft/opencc stuff in clojure?

I've actually thought about this. However, if I did make this, it would probably be a separate mod that used forge-clj, rather than being in forge-clj itself. The reason for this is that forge-clj is used for mods in general, and shouldn't have any dependencies (like computercraft/opencc) with the exception of clojure and other necessary apis like core.async, both of which get shaded into the mod itself.

Feel free to make something like this though, and if you're using forge-clj, even better! I believe that computercraft/opencc is open source, and if it might be useful, there's a (very old) clojure compiler for Lua available here.

However, it might be easier to just add commands that reference Computercraft's api (for example, a "break block" function for turtles, that redirects to the Computercraft version of such a thing), and then eval things that the user types in.

commented

@yoshiquest I mean adding computercraft/opencc peripheral support to mods written in clojure without having to import all of the Java ILua stuff. With clojure macros etc. all of the boilerplate can be removed easily. As opencc/computercraft/Lua in general are extremely prevalent in Minecraft modding, having native support would make adding Lua/CC integration easier

I suppose I could take a look at it, but it's low priority right now. There's still plenty of general features that need to be completed first. I'll see what I can do though.

commented

@yoshiquest thanks, really appreciate it!

Just saying, it will be quite some time before I eventually get to this. If you really want this feature, I'd highly recommend you implement it yourself (unless you want to wait, like, months). There are a decent number of tools I use for java inter-op in forge-clj.core, and plenty of examples of their usage scattered throughout my code. I could also write a tutorial for the core tools if you want.

Honestly, this API really isn't going to cover EVERYTHING, as there is just so much to cover. The core tools are a way to allow others to create macros for the parts that forge-clj doesn't cover.

commented

@yoshiquest as much as I would love to, I probably won't be able to produce anything useful. I am a complete neophyte when it comes to Clojure and I don't have much experience with Java either due to me avoiding it like a plague after a less than pleasant encounter with the practice of boilerplate spamming, aka Android Development.