Browse Source

first little pass, everything is broken.

Will resume on other computer.
legacy
touky 8 years ago
parent
commit
893ab7b6f5
5 changed files with 78 additions and 66 deletions
  1. +28
    -0
      .vscode/c_cpp_properties.json
  2. +15
    -0
      build/Lol (vs2015).sln
  3. +15
    -7
      doc/tutorial/14_lol_lua.cpp
  4. +2
    -2
      doc/tutorial/imgui.ini
  5. +18
    -57
      src/lolua/baselua.h

+ 28
- 0
.vscode/c_cpp_properties.json View File

@@ -0,0 +1,28 @@
{
"configurations": [
{
"name": "Mac",
"includePath": ["/usr/include"],
"browse" : {
"limitSymbolsToIncludedHeaders" : true,
"databaseFilename" : ""
}
},
{
"name": "Linux",
"includePath": ["/usr/include"],
"browse" : {
"limitSymbolsToIncludedHeaders" : true,
"databaseFilename" : ""
}
},
{
"name": "Win32",
"includePath": ["c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include", "src"],
"browse" : {
"limitSymbolsToIncludedHeaders" : true,
"databaseFilename" : ""
}
}
]
}

+ 15
- 0
build/Lol (vs2015).sln View File

@@ -66,6 +66,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{B629
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "15_lolimgui", "..\doc\tutorial\15_lolimgui.vcxproj", "{81C83B42-D00A-4FA3-9A3D-80F9D46524BF}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "15_lolimgui", "..\doc\tutorial\15_lolimgui.vcxproj", "{81C83B42-D00A-4FA3-9A3D-80F9D46524BF}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "14_lol_lua", "..\doc\tutorial\14_lol_lua.vcxproj", "{31B96262-1C41-43B9-BA38-27AA385B05DB}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ORBIS = Debug|ORBIS Debug|ORBIS = Debug|ORBIS
@@ -308,6 +310,18 @@ Global
{81C83B42-D00A-4FA3-9A3D-80F9D46524BF}.Release|Win32.Build.0 = Release|Win32 {81C83B42-D00A-4FA3-9A3D-80F9D46524BF}.Release|Win32.Build.0 = Release|Win32
{81C83B42-D00A-4FA3-9A3D-80F9D46524BF}.Release|x64.ActiveCfg = Release|x64 {81C83B42-D00A-4FA3-9A3D-80F9D46524BF}.Release|x64.ActiveCfg = Release|x64
{81C83B42-D00A-4FA3-9A3D-80F9D46524BF}.Release|x64.Build.0 = Release|x64 {81C83B42-D00A-4FA3-9A3D-80F9D46524BF}.Release|x64.Build.0 = Release|x64
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Debug|ORBIS.ActiveCfg = Debug|ORBIS
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Debug|ORBIS.Build.0 = Debug|ORBIS
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Debug|Win32.ActiveCfg = Debug|Win32
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Debug|Win32.Build.0 = Debug|Win32
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Debug|x64.ActiveCfg = Debug|x64
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Debug|x64.Build.0 = Debug|x64
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Release|ORBIS.ActiveCfg = Release|ORBIS
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Release|ORBIS.Build.0 = Release|ORBIS
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Release|Win32.ActiveCfg = Release|Win32
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Release|Win32.Build.0 = Release|Win32
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Release|x64.ActiveCfg = Release|x64
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@@ -341,5 +355,6 @@ Global
{73F1A804-1116-46C3-922A-9C0ADEB33F52} = {4C4BD478-3767-4C27-BD91-DAAFE7CD03A2} {73F1A804-1116-46C3-922A-9C0ADEB33F52} = {4C4BD478-3767-4C27-BD91-DAAFE7CD03A2}
{B6297FF2-63D0-41EE-BE13-EFF720C9B0FA} = {1AFD580B-98B8-4689-B661-38C41132C60E} {B6297FF2-63D0-41EE-BE13-EFF720C9B0FA} = {1AFD580B-98B8-4689-B661-38C41132C60E}
{81C83B42-D00A-4FA3-9A3D-80F9D46524BF} = {E74CF679-CA2A-47E9-B1F4-3779D6AC6B04} {81C83B42-D00A-4FA3-9A3D-80F9D46524BF} = {E74CF679-CA2A-47E9-B1F4-3779D6AC6B04}
{31B96262-1C41-43B9-BA38-27AA385B05DB} = {E74CF679-CA2A-47E9-B1F4-3779D6AC6B04}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

+ 15
- 7
doc/tutorial/14_lol_lua.cpp View File

@@ -37,18 +37,26 @@ public:
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
static int AddFive(lua_State* l) static int AddFive(lua_State* l)
{ {
LuaInt32 i; i.Get(l, 1);
LuaStack stack(l);
int32_t i = stack.GetVar<int32_t>();
//LuaInt32 i; i.Get(l, 1);
i += 5; i += 5;
return i.Return(l);
}
//return i.Return(l);
return stack.SetVar(i).Return();
}
static int AddTenInstance(lua_State* l) static int AddTenInstance(lua_State* l)
{ {
LuaStack stack(l); LuaStack stack(l);
LuaDemoObjectPtr obj;
LuaFloat f;
stack >> obj >> f;
DemoObject* obj = nullptr; // stack.GetPtr<DemoObject>();
float f = stack.GetVar<float>();

//LuaDemoObjectPtr obj;
//LuaFloat f;
//stack >> obj >> f;
f = obj->AddTenMethod(f); f = obj->AddTenMethod(f);
return f.Return(l);

//return f.Return(l);
return 0;// stack.SetVar(f).SetPtr().Return();
} }
float AddTenMethod(float f) float AddTenMethod(float f)
{ {


+ 2
- 2
doc/tutorial/imgui.ini View File

@@ -4,12 +4,12 @@ Size=400,400
Collapsed=0 Collapsed=0


[testature] [testature]
Pos=266,15
Pos=187,98
Size=494,359 Size=494,359
Collapsed=0 Collapsed=0


[SO FUN !!] [SO FUN !!]
Pos=30,24
Pos=16,24
Size=113,99 Size=113,99
Collapsed=0 Collapsed=0



+ 18
- 57
src/lolua/baselua.h View File

@@ -883,6 +883,24 @@ public:
return lua_gettop(m_state); return lua_gettop(m_state);
} }


//-------------------------------------------------------------------------
template<typename T>
T GetVar(T defaultValue = 0, bool isOptional = false)
{
return Var<T>(defaultValue, m_state, m_index, isOptional).GetValue();
}

//-------------------------------------------------------------------------
template<typename T>
Stack& SetVar(T& value)
{
m_result += Var<T>(value, m_state, m_index).Return(m_state);
return *this;
}

//-------------------------------------------------------------------------
int32_t Return() { return m_result; }

//------------------------------------------------------------------------- //-------------------------------------------------------------------------
template<typename T> template<typename T>
Stack& operator>>(T& var) Stack& operator>>(T& var)
@@ -891,42 +909,6 @@ public:
return *this; return *this;
} }


/*
template<typename T>
Stack& operator>>(Var<T>& var)
{
var = Var<T>(var.GetValue(), m_state, m_index, var.IsOptional());
return *this;
}
template<typename T>
Stack& operator>>(Var<T>& var)
{
var = Var<T>(var.GetValue(), m_state, m_index, var.IsOptional());
return *this;
}
template<typename T>
Stack& operator>>(VarPtr<T>& var)
{
var = VarPtr<T>(m_state, m_index);
return *this;
}
*/
/*
template<typename T>
Stack& operator>>(T& var)
{
Var<T> ret(m_state, m_index);
var = ret.GetValue();
return *this;
}
template<typename T>
Stack& operator>>(VarPtrLight<T>& var)
{
var = VarPtrLight<T>(m_state, m_index);
return *this;
}
*/

//------------------------------------------------------------------------- //-------------------------------------------------------------------------
template<typename T> template<typename T>
Stack& operator<<(T& var) Stack& operator<<(T& var)
@@ -934,27 +916,6 @@ public:
m_result += var.Return(m_state); m_result += var.Return(m_state);
return *this; return *this;
} }
/*
template<typename T>
Stack& operator<<(T& var)
{
Var<T> ret(var, false);
m_result += ret.Return(m_state);
return *this;
}
template<typename T>
Stack& operator<<(VarPtr<T>& var)
{
m_result += var.Return(m_state);
return *this;
}
template<typename T>
Stack& operator<<(VarPtrLight<T>& var)
{
m_result += var.Return(m_state);
return *this;
}
*/


private: private:
lua_State* m_state = nullptr; lua_State* m_state = nullptr;


Loading…
Cancel
Save