Why does this code not work? I used visual studio and I added the file into the project and it doe sn't throw any errors. I also added the lua in the project and the directory
#include "lua/LuaScriptInterface.h"
#include "lua/LuaLuna.h"
#include "lua/LuaScriptHelper.h"
#include "lua/LuaBit.h"
#include "lua/LuaWindow.h"
#include "lua/LuaButton.h"
#include "lua/LuaLabel.h"
#include "lua/LuaTextbox.h"
#include "lua/LuaCheckbox.h"
#include "lua/LuaSlider.h"
#include "lua/LuaProgressBar.h"
void luaopen_scriptmanager(lua_State *l){
#ifndef _MSC_VER
int scriptmanager_luac_sz = 37193;
const char* scriptmanager_luac = "crap";
luaL_loadbuffer(l, scriptmanager_luac, scriptmanager_luac_sz, "@scriptmanager.lua");
lua_pcall(l, 0, 0, 0);
#endif
}
What error does it give you?
No errors. (I said that already above)
Oh, my bad.
What does go wrong?
I've been using this code:
if(luaL_loadstring(l, scriptmanager_luac) || lua_pcall(l, 0, 0, 0))
luacon_ci->Log(CommandInterface::LogError, luacon_geterror());
else
luacon_ci->Log(CommandInterface::LogNotice, "Loaded script manager");
That might work better than what you're using, but tbh I only vaguely know what I'm doing
It's best to do it in the same way it loads autorun.lua, but with a predefined const char* for the source instead of a file. I'd even do it in the same place, just for organization's sake.
On an unrealted note sim->drawline or whatever that is doesn't work apparently it doesn't accept arguments of int int int int int, despite following the wiki exactly. Anyone know why
It works perfectly! (Not the script since it's too long lol) but why is the line so thick?