lua and newline

Started by
0 comments, last by RolandofGilead 19 years, 2 months ago
i want ot be able to load all my files into memory before runtime, if possible. by parseing the lua files and replaceing the '\n' with a ';' will i be able to send the whole file at once to lua with lua_dostring? or should i just call it for each line and let the interpreter worry about what to do? or is this all irelevant and all i can pass it the whole file as a STRING because lua won't care if the STRING to lua_dostring is composed of more than one LINE? PS: is there anyway to find out how many arguments are on the stack when lua calls a c callback function?
I just wanna get this done.
Advertisement
As far as that goes, just call dofile, but yes, you can load the entire file at once into one string and call dostring on it.

You might get the size of the stack before the callback and then once again before you start retrieving values from the stack. I don't know how you're binding your C functions but it shouldn't be too hard to add a couple of lines to the callback manually(hope you don't have too many).

This topic is closed to new replies.

Advertisement