• Programing a C++ command line tool that uses lua
    9 replies, posted
Hello, it is only but very rarely that i come here, so if this has already been asked, or has been explained somewhere else, please point me in the right direction and let the thread die, thank you. Does anyone have an idea on how to make a C++ command line tool that loads all the lua files in a certain folder so i could utilise it, like make a command module and utilize a print function and stuff?
On which platform? And why C++? You could just write a shell / batch script that would loop through a directory and execute lua <file>.lua for every lua file.
[QUOTE=esalaka;23725077]On which platform? And why C++? You could just write a shell / batch script that would loop through a directory and execute lua <file>.lua for every lua file.[/QUOTE] Judging from the title, I think he wants to hook into Lua.
[QUOTE=<ToD> Aaron;23725707]Judging from the title, I think he wants to hook into Lua.[/QUOTE] But why? The basic idea is that you link to liblua5.1 (Or whichever version you want), initialize lua and loop through a folder (With, for example, the classes provided by boost::filesystem) and load every found .lua file but I can't even give a guide on how to do that since I don't know which compiler he's using and haven't actually done this .__.
[QUOTE=esalaka;23725826]But why? The basic idea is that you link to liblua5.1 (Or whichever version you want), initialize lua and loop through a folder (With, for example, the classes provided by boost::filesystem) and load every found .lua file but I can't even give a guide on how to do that since I don't know which compiler he's using and haven't actually done this .__.[/QUOTE] *shrug* Maybe he wants to make some modifications to lua or something? Add his own stuff to it? Not sure, never worked with lua in this kind of setting. (Barely worked with it as a language, let alone from another language)
Yes, i want to modify the lua language and also add some C++ functions into it. And i dont want JUST to use lua, so a batch file wont cut it either. As the title says, i need a tuto on making a C++ command line tool that has a lua binding, and not anything else. Thank you
hmm, never done it before but [url=http://csl.sublevel3.org/lua/]this[/url] could be of use to you. [editline]08:30AM[/editline] Look at the part about calling C functions from Lua. It's actually talking about C++ (unless I'm mistaken, but I don't believe so)
Already looked at that, and for some reason when i compile it it doesnt find lua.h and stuff except its int he folder. Do you want the project?
[QUOTE=Ningaglio;23727537]Already looked at that, and for some reason when i compile it it doesnt find lua.h and stuff except its int he folder. Do you want the project?[/QUOTE] You'll have to tell the linker where the Lua headers and stuff are located, or just copy all the lua source to the source folder of your project.
i tried compying the whole source, it errors too
Sorry, you need to Log In to post a reply to this thread.