Search code examples
c++cscriptingarmembedded-language

A scripting language to simply compile


I'm looking for a simple script language which I can compile easily by just putting the .h files under an include folder and the .c/.cpp files under a source directory. Something without any Makefile. Must be written in C/C++ rather C++.


Okay so LUA doesn't work, I need something which I can just call a simple method and it will handle a script file. Without any load from file methods in it, or atleast something which doesn't use the stdio.h.


Solution

  • Lua is a simple lightweight scripting language that can be easily embedded into your application. It is written in C (I don't really understand what you mean by "Must be written in C/C++ rather C++").

    You can simply add all files from the src directory except for lua.c and luac.c into your project and it should work.

    Note that if you're including from a C++ file, you have to wrap includes in extern "C" block. The following compiles and links for me.

    extern "C" {
    #include <lua.h>
    #include <lauxlib.h>
    }
    
    int main()
    {
        lua_State* L = lua_open();
    }