かなり適用な実験コードです。
> lua5_1_4_Win32_dll8_lib.zip
http://luabinaries.luaforge.net/download.html
#uselib "lua5.1.dll"
#func luaL_newstate "luaL_newstate"
#func luaopen_io "luaopen_io"
#func luaL_loadstring "luaL_loadstring" int, str
#func lua_pushstring "lua_pushstring" int, str
#func lua_pushcclosure "lua_pushcclosure" int, int, int
#func lua_call "lua_call" int, int, int
#func lua_pcall "lua_pcall" int, int, int, int
#func lua_getfield "lua_getfield" int, int, str
#func lua_tolstring "lua_tolstring" int, int, int
#func lua_close "lua_close" int
	onexit *exit
	luaL_newstate
	L = stat
	lua_pushcclosure L, varptr(luaopen_io), 0
	lua_pushstring L, "io"
	lua_call L, 1, 0
	sdim buf, 4048
	buf = {"file=io.open(\"test_lua.txt\",\"w\");
	file:write(\"あいうえおーん\\nファイルの出力\");
	file:close();
	x=100;
	y=50;
	value=\"結果は \" .. x*y .. \" でした\";"}
	mesbox buf, 500, 200
	button "", *go
	stop
*go
	luaL_loadstring L, buf
	lua_pcall L, 0, 0, 0
	mes stat
#define LUA_GLOBALSINDEX -10002
	lua_getfield L, LUA_GLOBALSINDEX, "value"
	lua_tolstring L, -1
	mes strf("%s", stat)
	stop
*exit
	lua_close L
	end