This can be used for creating, testing and using CSMs without reloading the game, and without the game crashing. This is also the easiest way to create advanced formspecs. It was tested with multiple CSMs, and they all worked. (actually in the current version, a few things might not work, but they will be fixed in the future)

CSMs can be created, or pasted in, and they should work the same as they would normally, except errors won't crash the game!

functions that are registered with minetest can be put in a function safe(func) to output errors to the UI when minetest calls them

scripts can be put in startup to run them automatically when the game loads. errors are also put in the UI

- use the command .dte to open the editor- select the lua editor tab to run and edit CSMs- select the formspec editor tab to create a formspec- select the files tab to open, create, and delete files- select the startup tab to select lua files to run when the game loads

How to install

- make sure you have client modding enabled (search for client modding in advanced settings, and set it to true)- download and extract the zip file into clientmods\csm_dte or paste the init.lua file into it.- add load_mod_csm_dte = true to the clientmods\mods.conf file- join a game or server, and it should work!

Please tell me of any differences when running a CSM in this and the usual way. ThanksI also need a list of API functions for registering functions with minetest, and a list of functions which only work before the game has loaded.

Last edited by FiftySix on Mon Jul 02, 2018 11:48, edited 6 times in total.

This is a very interesting concept, and I quite like it - in fact, I once considered making something similar. There is one very basic problem, however, that for me anyway voids the usefulness of the entire concept. That reason is that Minetest's textarea is very limited. For me to be happy with writing more than a few short lines of code in an editor, it must at least have automatic indentation and syntax highlighting, two things which are completely impossible to implement within Minetest. Besides that, I'd prefer if it had the ability to do things such as select multiple parts of the code at once (multiple cursors). Not only that, but I usually have trouble copy-pasting stuff in and out of Minetest due to a weird bug in Irrlicht related to Linux, so I wouldn't be able to use it efficiently no matter what, but this is in no way your fault as it doesn't even have anything to do with Minetest.

Anyways, TL;DR: this is an amazing idea and a good implementation, but it lacks features that are impossible in Minetest, features that I consider a requirement for a good code editor.

May I also suggest that maybe you rename this to "lua_editor", and title it "In-Game Lua Code Editor"? Why? Well, the term IDE (Integrated Development Environment) refers to an environment usually specialized for a specific language, having debugging and testing tools, and usually having many if not all of the features I mentioned above.

octacian wrote:This is a very interesting concept, and I quite like it

Thank You!

The textarea is not great for writing in, but things can easily be pasted into it. My idea of how I would use it, was to write the code in a normal text editor, then copy it into the textarea (I'm on windows), so I wouldn't have to reload the game, and it wouldn't crash.My post was poorly written and rushed, so I will probably make it more usefull in the future.

I will rename it to something else, probably not "Lua Editor", because I plan on adding some features for UI design and testing. Maybe "CSM Designing and Testing Envirnonment", or "CSM DTE" for short.

All(most?) options for registering functions with minetest will be overwritten in a future version, meaning they will work after startup. So far the only function which I have done this for is minetest(/core).get_mod_storage(). They will also automatically be run in a safe environment (error catching) without using the safe() function, and can hopefully be unregistered from the GUI.

A list of API functions for registering things or commands would be usefull, since I am new to modding. but most importantly all functions which don't work after startup.

The idea of a preview of a formspec is very good. I wonder if it might be possible to just write the code with a normal editor and let the test mod read and interpret that text file whenever the developper requests an update. Would be horribly insecure in general gameplay; but developping your own mods is another matter.

I'm pretty sure you have misunderstood (or is it me?). I am talking about a preview of part of the project I am working on. The file (which I called the preview file) is a formspec creator, which generates the code for a formspec. And your idea for reading a file which was edited with a normal editor is currently not possible, because CSMs don't have file access (my few tests show at least).

I love the formspec editor. Just one request. Allow users to reset the editor if this happens?(I just unchecked the item tickbox to remove but it the img was bigger...)

Also: maybe add the ability to set the background? (I didn't see it)EDIT: The ability to duplicate elements would be niceEDIT2: The ability to move elements around with some buttons in this form on the side somewhere

There is now a new version.- Widgets can't overlap the editor. A red box is displayed to show the area it would be- The colour of the background can be set- Images can be made background images- Widgets can be duplicated- The new widget menu can be accessed without having to leave the selected widget- the delete button has moved- 2 new widgets have been added: tooltip and tabs- The colour of InvLists can now be changed (from the Display tab because you can't change individual list colours)- The Size menu has been renamed to Display because it has more stuff- The size of the window is now displayed with an outline (shows actual size, and 0, 0 to width, height)

Edit:I will not add the movement control buttons, but I will try and make keyboard controls move widgets (edit 2: not possible as far as I can see).If I do add an option to import formspec strings, it won't be any time soon

Last edited by FiftySix on Sun Jul 01, 2018 12:37, edited 2 times in total.

FiftySix wrote:There is now a new version.- Widgets can't overlap the editor. A red box is displayed to show the area it would be- The colour of the background can be set- Images can be made background images- Widgets can be duplicated- The new widget menu can be accessed without having to leave the selected widget- the delete button has moved- 2 new widgets have been added: tooltip and tabs- The colour of InvLists can now be changed (from the Display tab because you can't change individual list colours)- The Size menu has been renamed to Display because it has more stuff- The size of the window is now displayed with an outline (shows actual size, and 0, 0 to width, height)

I have finally put the formspec editor into the main file!So the formspec editor is part of the same mod, and can be accessed from the same UI, using tabs.Now it is is much easier to access the formspec editor, because it doesn't have to be installed separately, and I hope more people will get to use it!