Question

I'm writing my lua code with SciTE, i wrote a C function that could be invoked by lua like this:

int hello(lua_State* L){
printf("----->> Hi! %s\n", lua_tostring(L, 1));
return 0;
}

and my lua code is like this:

zcLua.hello('Kitty')
print'hello'

('zcLua' is the libname i registered). in lua console, the output is

----->> Hi! Kitty
hello

but in SciTE the output is reversed :

hello
----->> Hi! Kitty

how can i correct that? seems it's because code print'hello' is executed faster than invoking the c function

Was it helpful?

Solution

As I don't know SciTE, I can't tell it for sure. But I think the print function is refined in the editor, which places the output data in a buffer that is only displayed at the end of script, or in a separate thread.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top