lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello!

I've bound an SDK to Lua using toLua++.
The binding seems to run ok.  In my C++ main() program I do

	int  tolua_ScriptInterface_open (lua_State*);

	lua_State* L = lua_open();
	luaopen_base(L);
	luaopen_string(L);
	luaopen_table(L);
	luaopen_io(L);
	luaopen_math(L);
	luaopen_loadlib(L);
	tolua_ScriptInterface_open(L);

	lua_dofile(L,"testScript.lua");
	lua_close(L);


In my "testScript.lua" I can run lots of lib-methods: for instance, I can open a file and write to it, convert numbers to strings, even access exported SDK methods without problem.  Here's a sample of what works:

x = tonumber("456")
y = tostring(666)
local f = assert(io.open("test.out", "wa"))
f:write(x, y, 111, 222, 666)
f:close()

HOWEVER:  when I do the basic, simple

print(y)

it crashes in file "lbaselib.c" in method "luaB_print" (bound to print) near the very end on the
fputs(s, stdout);
statement, WHEREBY THE "s" PARAMETER HAS THE CORRECT STRING (I'm looking at this in VC++ 6.0)!!!

What's the deal here?  Can anyone help?  This is basic stuff!

Thanx,
Mark

P.S.  When I run the same script "testScript.lua" from a standalone lua command-line .exe, it works perfect.