Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

VividScript

VividScript

AntRWells
AntRWells
AntRWells · · 1 min read
4,133 0

Resumed work on Vivid-Script. Vivid-Script is a managed, real time scripting language. It is wrote for Vivid3D, and as such will not just be a normal language with a set of functions,

it will instead offer several features that connect closely with the engine. It works on a dynamic engine. i.e, it uses a lot of the C# dynamics feature, so that code is clean and safe, by ensuring there are no mis-matches before running.

here is a simple script, that runs fine. and also there is the code to run it in c#

module TestModule

    int testVal

end

func Entry(int age,string name)

    printf("Hey testing!"+" Oh yeah!"+" This is working!")

end 

And here is the code to run it,

  VSource src = new VSource("test1.vs");
            VCompiler comp = new VCompiler();
            VCompiledSource s = comp.Compile(src);

            VME test_vme = new VME();

            test_vme.SetEntry ( s.EntryPoint );

            test_vme.RunEntry ( );

And here is the function that registers C# methods/code to the language, so it can connect to normal C# methods easily.


 public void RegisterOSFuncs ( )
        {
            // - printF( <Expressions> )

            CFuncLink printF = new CFuncLink
            {
                Link = ( t ) =>
                {
                    Console.WriteLine ( "printF:" + t[0]);

                    return null;
                }
            };

            AddCFunc ( "printf", printF );
        }


Discussion

Loading comments...