им попробовать другие языки. Got VB2013 и LuaForWindows 5.1 Какова самая основная файловая структура для запуска файла .lua в моей программе? я в настоящее время делается http://www.youtube.com/watch?v=w51pftzS1_8 включает в себя часть, сделал .h файл, который выглядит как этотC++ И lua-как начать?
#ifndef __LUA_INC_H__
#define __LUA_INC_H__
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
#endif // __LUA_INC_H__
и Run.cpp как этот
#include <iostream>
#include <conio.h>
#include <iostream>
#include "LuaInc.h"
using namespace std;
int main()
{
int iErr = 0;
lua_State *lua = lua_open(); // Open Lua
luaopen_io(lua); // Load io library
if ((iErr = luaL_loadfile(lua, "test.lua")) == 0)
{
// Call main...
if ((iErr = lua_pcall(lua, 0, LUA_MULTRET, 0)) == 0)
{
// Push the function name onto the stack
lua_pushstring(lua, "helloWorld");
// Function is located in the Global Table
lua_gettable(lua, LUA_GLOBALSINDEX);
lua_pcall(lua, 0, 0, 0);
}
}
lua_close(lua);
_getch();
return 0;
}
файл test.lua находится в директории vb213 проектов/MyProject/MyProject
и выглядит следующим образом
function helloWorld()
io.write ("hello World")
end
Вы запрашиваете более минимальный пример, чем то, что у вас есть выше? – greatwolf