December 14

On Thursday, 14 December 2023 at 13:59:05 UTC, bachmeier wrote:

>

On Thursday, 14 December 2023 at 08:38:02 UTC, solidstate1991 wrote:

>

..
..

If you're willing to go with Lisp, there are small, embeddable Schemes: s7 and Chibi, one that is more Clojure-like: Janet, and one that's more like Lua: Squirrel.

+1

I heard some nice things about chibi on the interwebs.
Not used it, tho.

:-)

December 14

On Thursday, 14 December 2023 at 08:38:02 UTC, solidstate1991 wrote:

>

I need a lightweight scripting language with integer support that is either easy to interface with D (preferrably as a DLL/SO file, so I don't have to deal with godawful C/C++ build systems), or at least would be easy to port within a few weeks.

Squirrel comes to mind. It’s similar to Lua but has a C-like syntax and some extra types and features. It’s very lightweight; D bindings can be written in half an hour, and the entire C++ code base is just 7k lines of code. Used in some games by Valve.

December 14

On Thursday, 14 December 2023 at 09:43:03 UTC, solidstate1991 wrote:

>

On Thursday, 14 December 2023 at 09:35:43 UTC, Sergey wrote:

>

Maybe wren?

Wren is one of those fashionable scripting languages that skimp out on the integer support because "they can just be represented with floating point numbers".

As a Wren user: it works and is OK, but I wouldn't necessarily recommend Wren that much not for these reasons, but because it's not that easy to interface with and imports are annoying, also it's basically abandoned. The syntax is a polar opposite to D. We've modified the interpreter for our needs but surely there must be better alternatives, such as... regular Lua. I would have choosen something else now.

December 14

On Thursday, 14 December 2023 at 09:43:03 UTC, solidstate1991 wrote:

>

On Thursday, 14 December 2023 at 09:35:43 UTC, Sergey wrote:

>

Maybe wren?

Wren is one of those fashionable scripting languages that skimp out on the integer support because "they can just be represented with floating point numbers".

Probably not that hard to add support though, if you can live with weak typing (casts from float to int will only be detected at runtime).

December 14

On Thursday, 14 December 2023 at 15:04:40 UTC, Ogi wrote:

>

Squirrel comes to mind. It’s similar to Lua but has a C-like syntax and some extra types and features. It’s very lightweight; D bindings can be written in half an hour, and the entire C++ code base is just 7k lines of code. Used in some games by Valve.

Which has GC (reference counting/tracing hybrid) and yet it is used in video games. If D can improve the GC implementation it will be suitable for games as well.

December 14
On Thursday, 14 December 2023 at 15:44:21 UTC, IGotD- wrote:
> ...
> Which has GC (reference counting/tracing hybrid) and yet it is used in video games. If D can improve the GC implementation it will be suitable for games as well.

I hope do not to disturb the thread, but why people use GC in games?

I always allocate everything I want before hand and work with that space.

Now If someone would like to write a game with GC in mind, wouldn't be reasonable to do:

Allocate();
GC.disable();
run_the_game();
GC.enable();

?

Matheus.
December 14

On Thursday, 14 December 2023 at 18:18:21 UTC, matheus wrote:

>

Now If someone would like to write a game with GC in mind, wouldn't be reasonable to do:

Allocate();
GC.disable();
run_the_game();
GC.enable();

Is the run_the_game() part of code supposed to be annotated with the @nogc attribute?

December 14

On Thursday, 14 December 2023 at 09:55:18 UTC, Hors wrote:

>

On Thursday, 14 December 2023 at 09:43:03 UTC, solidstate1991 wrote:

>

On Thursday, 14 December 2023 at 09:35:43 UTC, Sergey wrote:

>

Maybe wren?

Wren is one of those fashionable scripting languages that skimp out on the integer support because "they can just be represented with floating point numbers".

Just a question: Isn't casting (rounding) floating numbers to integers an option? Why?

I had this issue with Lua 5.1. It "works" for medium-ish integers, but as soon as you're encoding data in ints, such as unique IDs made up of multiple components that may have high bits set, it'll fall apart. I am still using Lua 5.1, but now I just.. don't do that anymore. Unfortunately if you want to pass along data that would otherwise be a 64-bit int, you either have to send along a raw pointer or else create a Lua-GC-allocated object to hold it instead (and at that point you may as well just use userdata for the D object itself).

While not recommending it as such, I believe Julia supports multiple int types, though my cursory examination suggested the performance and resource draw is far, far worse than Lua.

December 14

On Thursday, 14 December 2023 at 08:38:02 UTC, solidstate1991 wrote:

>

After losing a battle with trying to get Lua 5.4 working on my own end, with problems I previously solved kept reappearing, and other problems just were unable to fix for no good reason, I've decided to drop it from my own game engine in favor of some replacement.

What problems did you have with Lua 5.4? Building it, linking it, driving it from D, Lua as a language? It's very tough competition. I got to 'hello world' pretty quickly with bindbc-lua,

#! /usr/bin/env dub
/++ dub.sdl:
    dependency "bindbc-lua" version="~>0.6.0"
    versions "LUA_54"
    libs "lua-5.4"
+/
import bindbc.lua;
import std.stdio : writeln;

void main() {
    LuaSupport ret = loadLua();
    assert(ret != luaSupport.noLibrary, "Lua shared library failed to load");
    assert(ret != luaSupport.badLibrary, "One or more symbols failed to load. Bad version?");
    assert(ret == luaSupport);

    auto L = luaL_newstate();
    assert(L, "failed to open Lua");
    luaL_openlibs(L);
    luaL_loadstring(L, "print 'hello world'");
    lua_call(L, 0, 0);
    lua_close(L);
}

and Lua 5.4 has integers:

$ lua -e 'print(_VERSION, 9223372036854775807)'
Lua 5.4 9223372036854775807

vs.

$ luajit -e 'print(_VERSION, 9223372036854775807)'
Lua 5.1 9.2233720368548e+18
December 14

On Thursday, 14 December 2023 at 11:03:55 UTC, Hipreme wrote:

>

The only scripting language which I know that supports integer is AngelScript

AngelScript was a user-exposed scripting language in Star Ruler and its sequel, cross-platform space 4x games. It seemed pretty reasonable there, and supposedly adds <2MB to a build. It's also a much more normal language than Lua if the language was the problem.