aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api
diff options
context:
space:
mode:
authorAlexander Pickering <alex@cogarr.net>2018-09-10 23:11:08 -0400
committerAlexander Pickering <alex@cogarr.net>2018-09-10 23:11:08 -0400
commitc38d5eca7091fc7f0206ed0c746622022b2ae508 (patch)
tree8c01d4a941b4152675354b8b7a46c0906e9fb40c /src/client/lua_api
parentb3c0d2ead1f384b35615be562c5f06804e8990cb (diff)
downloadbrokengine-c38d5eca7091fc7f0206ed0c746622022b2ae508.tar.gz
brokengine-c38d5eca7091fc7f0206ed0c746622022b2ae508.tar.bz2
brokengine-c38d5eca7091fc7f0206ed0c746622022b2ae508.zip
Added documentation
Also added treeview guielemnt Also added ifilesystem guielement Also added io library
Diffstat (limited to 'src/client/lua_api')
-rw-r--r--src/client/lua_api/gui/iguibutton.cpp6
-rw-r--r--src/client/lua_api/gui/iguicheckbox.cpp6
-rw-r--r--src/client/lua_api/gui/iguicolorselector.cpp13
-rw-r--r--src/client/lua_api/gui/iguieditbox.cpp7
-rw-r--r--src/client/lua_api/gui/iguielement.cpp14
-rw-r--r--src/client/lua_api/gui/iguielement.hpp2
-rw-r--r--src/client/lua_api/gui/iguifiledialog.cpp34
-rw-r--r--src/client/lua_api/gui/iguiimage.cpp25
-rw-r--r--src/client/lua_api/gui/iguilabel.cpp17
-rw-r--r--src/client/lua_api/gui/iguispinbox.cpp7
-rw-r--r--src/client/lua_api/gui/iguitreeview.cpp213
-rw-r--r--src/client/lua_api/gui/iguitreeview.hpp2
-rw-r--r--src/client/lua_api/gui/iguiwindow.cpp11
-rw-r--r--src/client/lua_api/gui/simple.cpp2
-rw-r--r--src/client/lua_api/io/ifilesystem.cpp106
-rw-r--r--src/client/lua_api/io/ifilesystem.hpp13
-rw-r--r--src/client/lua_api/load_gui.cpp3
-rw-r--r--src/client/lua_api/load_io.cpp11
-rw-r--r--src/client/lua_api/load_io.hpp11
-rw-r--r--src/client/lua_api/scene/imesh.cpp3
20 files changed, 478 insertions, 28 deletions
diff --git a/src/client/lua_api/gui/iguibutton.cpp b/src/client/lua_api/gui/iguibutton.cpp
index fa4370f..aabc992 100644
--- a/src/client/lua_api/gui/iguibutton.cpp
+++ b/src/client/lua_api/gui/iguibutton.cpp
@@ -30,10 +30,10 @@ char lhashkey[20];
/***
@function newbutton()
Creates a new checkbox
-@tparam dimensions rect The rectangle to place the button at. If the box has a parent,
+@tparam rect dimensions The rectangle to place the button at. If the box has a parent,
it is offset from the upper-left of the parent element.
-@tparam parent (iguielement | nil) parent The parent element of the button.
-@tparam default_text (string | nil) default_text The default text to have in the button
+@tparam string default_text The default text to have in the button
+@tparam ?iguielement parent The parent element of the button.
@treturn iguibutton The button element
*/
//gui.newbutton({{sx,sy},{ex,ey}},"text"[,parent])
diff --git a/src/client/lua_api/gui/iguicheckbox.cpp b/src/client/lua_api/gui/iguicheckbox.cpp
index adfc28e..794b8f1 100644
--- a/src/client/lua_api/gui/iguicheckbox.cpp
+++ b/src/client/lua_api/gui/iguicheckbox.cpp
@@ -20,10 +20,10 @@ extern IrrlichtDevice* device;
/***
@function newcheckbox()
Creates a new checkbox
-@tparam dimensions rect The rectangle to place the box at. If the box has a parent,
+@tparam rect dimensions The rectangle to place the box at. If the box has a parent,
it is offset from the upper-left of the parent element.
-@tparam parent (iguielement | nil) parent The parent element of the edit box
-@tparam default_text (string | nil) default_text The default text to have in the edit box
+@tparam string default_text The default text to have in the edit box
+@tparam ?iguielement parent The parent element of the edit box
@treturn iguieditbox The edit box element
*/
//new({startx,starty},{endx,endy},"checkbox_name"[,ud_parent])
diff --git a/src/client/lua_api/gui/iguicolorselector.cpp b/src/client/lua_api/gui/iguicolorselector.cpp
index b85f765..8a61c6d 100644
--- a/src/client/lua_api/gui/iguicolorselector.cpp
+++ b/src/client/lua_api/gui/iguicolorselector.cpp
@@ -10,12 +10,22 @@ extern "C" {
#include "iguielement.hpp"
#include <shared/lua_api/common.hpp>
+/***
+@module gui
+*/
using namespace irr;
using namespace gui;
using namespace core;
extern IrrlichtDevice* device;
+/***
+@function newcolorselector()
+Creates a new checkbox
+@tparam string title The title for this color selector
+@tparam ?iguielement parent The parent element of the edit box
+@treturn iguicolorselector The color selector element
+*/
//newcolorselector("title"[,parent])
int newiguicolorselector(lua_State* L){
int nargs = lua_gettop(L);
@@ -48,9 +58,6 @@ int newiguicolorselector(lua_State* L){
}
static const luaL_reg iguicolorselector_m[] = {
- {"move", moveiguielement},
- {"setText", setiguitext},
- //{"remove", guisethandeler},
{0,0},
};
diff --git a/src/client/lua_api/gui/iguieditbox.cpp b/src/client/lua_api/gui/iguieditbox.cpp
index 790eaf3..6e4efa9 100644
--- a/src/client/lua_api/gui/iguieditbox.cpp
+++ b/src/client/lua_api/gui/iguieditbox.cpp
@@ -25,10 +25,9 @@ extern IrrlichtDevice* device;
/***
@function neweditbox()
Creates a new text entry box
-@tparam dimensions rect The rectangle to place the box at. If the box has a parent,
-it is offset from the upper-left of the parent element.
-@tparam parent (iguielement | nil) parent The parent element of the edit box
-@tparam default_text (string | nil) default_text The default text to have in the edit box
+@tparam rect dimensions The rectangle to place the box at. If the box has a parent, it is offset from the upper-left of the parent element.
+@tparam ?iguielement parent The parent element of the edit box
+@tparam ?string default_text The default text to have in the edit box
@treturn iguieditbox The edit box element
*/
//gui.neweditbox({{sx,sy},{ex,ey}}[,parent][,"default text"])
diff --git a/src/client/lua_api/gui/iguielement.cpp b/src/client/lua_api/gui/iguielement.cpp
index 7132441..3567d80 100644
--- a/src/client/lua_api/gui/iguielement.cpp
+++ b/src/client/lua_api/gui/iguielement.cpp
@@ -21,7 +21,7 @@ using namespace gui;
/***
Move a window (by an offset)
@function guielement:move()
-@tparam vec2 position The offset to move this element by
+@tparam vector2d position The offset to move this element by
*/
//move({element},{x,y}) -> nil
int moveiguielement(lua_State* L){
@@ -83,6 +83,18 @@ int setiguitext(lua_State* L){
return 0;
}
+//setRect({guielement},{{sx,sy},{ex,ey}}) :: nil
+int setrelrect(lua_State *L){
+ long sx,sy,ex,ey;
+ poprecti(L,&sx,&sy,&ex,&ey);
+ printf("Seting rect %ld %ld %ld %ld\n",sx,sy,ex,ey);
+ lua_getfield(L,-1,"guielement");//{guielement},ud_element
+ IGUIElement *el = (IGUIElement*)lua_touserdata(L,-1);
+ lua_pop(L,2);
+ el->setRelativePosition(rect<s32>(sx,sy,ex,ey));
+ return 0;
+}
+
/***
@function guielement:gettext()
diff --git a/src/client/lua_api/gui/iguielement.hpp b/src/client/lua_api/gui/iguielement.hpp
index aafbaab..0e08644 100644
--- a/src/client/lua_api/gui/iguielement.hpp
+++ b/src/client/lua_api/gui/iguielement.hpp
@@ -17,9 +17,11 @@ void setelementcallback(lua_State* L, irr::gui::EGUI_EVENT_TYPE et, const char*
int guigethandeler(lua_State* L);
int guisethandeler(lua_State* L);
int guigetid(lua_State* L);
+int setrelrect(lua_State *L);
static const luaL_reg iguielement_m[] = {
{"move", moveiguielement},
+ {"setrect", setrelrect},
{"getabsrect", getiguiclippingrect},
{"settext", setiguitext},
{"gettext", getiguitext},
diff --git a/src/client/lua_api/gui/iguifiledialog.cpp b/src/client/lua_api/gui/iguifiledialog.cpp
index ad95b13..6303230 100644
--- a/src/client/lua_api/gui/iguifiledialog.cpp
+++ b/src/client/lua_api/gui/iguifiledialog.cpp
@@ -29,11 +29,11 @@ extern IrrlichtDevice* device;
/***
@function newfileopendialog()
Creates a new dialog to open a file
-@tparam title string The rectangle to place the button at. If the box has a parent,
+@tparam ?string title The rectangle to place the button at. If the box has a parent,
it is offset from the upper-left of the parent element.
-@tparam path string The path to open the file dialog to
-@tparam parent (iguielement | nil) parent The parent element of the button.
-@tparam modal boolean If other gui elements can be interacted with before this element is closed
+@tparam ?string path The path to open the file dialog to
+@tparam ?iguielement parent The parent element of the button.
+@tparam ?boolean modal If other gui elements can be interacted with before this element is closed
@treturn iguifileopendialog The button element
*/
//gui.newfileopendialog(["title"][,"path"][,parent][,modal])
@@ -88,12 +88,38 @@ static int newfileopendialog(lua_State* L){
return 1;
}
+//{fileopendialog} -> "dir"
+int getdir(lua_State *L){
+ lua_getfield(L,-1,"guielement");//{fileopendialog},ud_fileopendialog
+ IGUIFileOpenDialog *f = (IGUIFileOpenDialog*)lua_touserdata(L,-1);
+ lua_pop(L,2);
+ const char *dname = f->getDirectoryName().c_str();
+ lua_pushstring(L,dname);
+ return 1;
+}
+
+//{fileopendialog} -> "name"
+int getname(lua_State *L){
+ lua_getfield(L, -1, "guielement");//{fileopendialog},ud_fileopendialog
+ IGUIFileOpenDialog *f = (IGUIFileOpenDialog*)lua_touserdata(L,-1);
+ lua_pop(L,2);//
+ const wchar_t *name_w = f->getFileName();
+ size_t slen = wcslen(name_w);
+ char name_c[slen + 1]; // + 1 for null
+ wcstombs(name_c,name_w,slen);
+ name_c[slen] = '\0';
+ lua_pushstring(L,name_c);
+ return 1;
+}
+
static const luaL_reg iguifileopendialog_f[] = {
{"new", newfileopendialog},
{0,0},
};
static const luaL_reg iguifileopendialog_m[] = {
+ {"getdir", getdir},
+ {"getname", getname},
{0,0},
};
diff --git a/src/client/lua_api/gui/iguiimage.cpp b/src/client/lua_api/gui/iguiimage.cpp
index 5ad8ba3..1d0f4dc 100644
--- a/src/client/lua_api/gui/iguiimage.cpp
+++ b/src/client/lua_api/gui/iguiimage.cpp
@@ -17,16 +17,35 @@ extern "C" {
#include "../../callbackhandeler.hpp"
#include <shared/lua_api/common.hpp>
+/***
+@module gui
+*/
using namespace irr;
using namespace gui;
extern IrrlichtDevice* device;
extern IGUIEnvironment* env;
-//new({startx,starty},alpha,{itexture}) -> {guielement}
+/***
+@function newiguiimage()
+Creates a new guielement with an image.
+The size of the iguielement is the same as the itexture used for it's creation.
+@tparam vector2d position The upper-left hand corner of the element.
+it is offset from the upper-left of the parent element.
+@tparam number alpha The transparency of the element.
+@tparam itexture texture The texture to display on this element.
+@tparam ?iguielement parent The parent element of the button.
+@treturn iguifileopendialog The button element
+*/
+//newiguiimage({startx,starty},alpha,{itexture}[,parent]) -> {guielement}
static int newiguiimage(lua_State* L){
//printf("Creating iguiimage\n");
-
+ IGUIElement *parent = NULL;
+ if(lua_gettop(L) > 3){
+ lua_getfield(L,-1,"guielement");
+ parent = (IGUIElement*)lua_touserdata(L,-1);
+ lua_pop(L,2);
+ }
lua_getfield(L,-1,"texture");//{startx,starty},alpha,{itexture},*itexture
video::ITexture* tex = (video::ITexture*)lua_touserdata(L,-1);
lua_pop(L,2);//{startx,starty},alpha,
@@ -38,7 +57,7 @@ static int newiguiimage(lua_State* L){
popvector2i(L,&sx,&sy);
IGUIEnvironment* env = device->getGUIEnvironment();
- IGUIImage* img = env->addImage(tex,core::position2d<s32>(sx,sy),usealpha,0,-1,L"");
+ IGUIImage* img = env->addImage(tex,core::position2d<s32>(sx,sy),usealpha,parent,-1,L"");
img->setImage(tex);
lua_newtable(L);
diff --git a/src/client/lua_api/gui/iguilabel.cpp b/src/client/lua_api/gui/iguilabel.cpp
index 92611b2..336f81c 100644
--- a/src/client/lua_api/gui/iguilabel.cpp
+++ b/src/client/lua_api/gui/iguilabel.cpp
@@ -17,12 +17,24 @@ extern "C" {
#include "../../callbackhandeler.hpp"
#include <shared/lua_api/common.hpp>
+/***
+@module gui
+*/
using namespace irr;
using namespace gui;
extern IrrlichtDevice* device;
-//gui.newguilabel({{sx,sy},{ex,ey}},"text"[,parent]) :: {guielement}
+/***
+@function newlabel()
+Creates a new label to display text.
+@tparam rect pos The position of the label, reletive to the upper-left of it's
+parent element, or the root window if parent is nil.
+@tparam string text The text to display on this label.
+@tparam ?iguielement parent The parent element of the button.
+@treturn iguilabel The label element
+*/
+//gui.newlabel({{sx,sy},{ex,ey}},"text"[,parent]) :: {guielement}
static int newiguilabel(lua_State* L){
printf("Createing label!\n");
int nargs = lua_gettop(L);
@@ -36,8 +48,9 @@ static int newiguilabel(lua_State* L){
const char* text = lua_tostring(L,-1);//{{sx,sy},{ex,ey}},"text"
int bls = strlen(text);
- wchar_t* text_w = (wchar_t*)malloc(sizeof(wchar_t)*bls);
+ wchar_t* text_w = (wchar_t*)malloc((sizeof(wchar_t)*bls) + 1);//+1 for null
mbstowcs(text_w,text,bls);
+ text_w[bls] = L'\0';
lua_pop(L,1);//{{sx,sy},{ex,ey}}
long sx, sy, ex, ey;
diff --git a/src/client/lua_api/gui/iguispinbox.cpp b/src/client/lua_api/gui/iguispinbox.cpp
index 0cea67e..7cb1775 100644
--- a/src/client/lua_api/gui/iguispinbox.cpp
+++ b/src/client/lua_api/gui/iguispinbox.cpp
@@ -24,10 +24,11 @@ extern IrrlichtDevice* device;
/***
@function newspinbox()
Creates a new spinbox
-@tparam dimensions rect The rectangle to place the button at. If the box has a parent,
+@tparam rect dimensions The rectangle to place the button at. If the box has a parent,
it is offset from the upper-left of the parent element.
-@tparam parent (iguielement | nil) parent The parent element of the button.
-@tparam default_text (string | nil) default_text The default text to have in the button
+@tparam ?string default_text The default text to display in the spinbox.
+@tparam ?iguielement parent The parent element of the button.
+@tparam ?boolean border Display a border around the spinbox
@treturn iguibutton The button element
*/
//gui.newspinbox({{sx,sy},{ex,ey}}[,"text"][,parent][,border])
diff --git a/src/client/lua_api/gui/iguitreeview.cpp b/src/client/lua_api/gui/iguitreeview.cpp
new file mode 100644
index 0000000..ca7b38d
--- /dev/null
+++ b/src/client/lua_api/gui/iguitreeview.cpp
@@ -0,0 +1,213 @@
+
+
+extern "C" {
+ #include <lua.h>
+ #include <lauxlib.h>
+ #include <lualib.h>
+}
+#include <irrlicht.h>
+#include "../guiparts.hpp"
+#include "iguielement.hpp"
+#include "client/callbackhandeler.hpp"
+#include <shared/lua_api/common.hpp>
+
+/***
+@module gui
+*/
+using namespace irr;
+using namespace core;
+using namespace gui;
+
+
+extern IrrlichtDevice* device;
+
+/***
+@function newtreeview()
+Creates a new tree view
+@tparam dimensions rect The rectangle to place the tree view at.
+If the box has a parent, it is offset from the upper-left of the parent element.
+@tparam ?iguielement parent The parent element of the button.
+@tparam ?boolean draw_background Should we draw a background for the tree view?
+@tparam ?boolean vertical_scroll Should there be a vertical scroll bar?
+@tparam ?boolean horizonal_scroll Should there be a horizontal scroll bar?
+@treturn iguitreeview The tree view element
+*/
+//gui.newtreeview({{sx,sy},{ex,ey}},[,parent][,draw_background][,vertical_scroll][,horizontal_scroll])
+static int newiguitreeview(lua_State* L){
+ //printf("Createing gui button!\n");
+
+ int nargs = lua_gettop(L);
+ IGUIElement* parent = NULL;
+ int draw_background, scrollvertical, scrollhorizontal;
+ if(nargs > 4){
+ scrollhorizontal = lua_toboolean(L,-1);
+ lua_pop(L,1);
+ }
+ if(nargs > 3){
+ scrollvertical = lua_toboolean(L,-1);
+ lua_pop(L,1);
+ }
+ if(nargs > 2){
+ draw_background = lua_toboolean(L,-1);
+ lua_pop(L,1);
+ }
+ if(nargs > 1){
+ if(!lua_isnil(L,-1)){
+ lua_getfield(L,-1,"guielement");
+ parent = (IGUIElement*)lua_touserdata(L,-1);
+ lua_pop(L,2);//{{sx,sy},{ex,ey}},"text"
+ }
+ }
+
+ long sx,sy,ex,ey;
+ poprecti(L,&sx,&sy,&ex,&ey);//
+
+ rect<s32> dim = rect<s32>(sx,sy,ex,ey);
+ IGUIEnvironment* env = device->getGUIEnvironment();
+ IGUITreeView* but = env->addTreeView(dim,parent,-1,draw_background,scrollvertical,scrollhorizontal);
+
+ lua_newtable(L);//{}
+ lua_pushlightuserdata(L,but);//{},ud_treeview
+ lua_setfield(L,-2,"guielement");//{guielement}
+ luaL_getmetatable(L,"gui.iguitreeview");//{guielement},{m_iguibutton}
+ lua_setmetatable(L,-2);//{guielement}
+
+ return 1;
+}
+
+//iguitreeview:getroot()
+int getRootNode(lua_State *L){
+ lua_getfield(L,-1,"guielement");//{treeview},ud_TreeView
+ IGUITreeView *v = (IGUITreeView*)lua_touserdata(L,-1);
+ lua_pop(L,2);//
+
+ IGUITreeViewNode *n = v->getRoot();//
+ lua_newtable(L);//{}
+ lua_pushlightuserdata(L,n);//{},ud_treeviewnode
+ lua_setfield(L,-2,"guielement");//{guielement=ud_treeviewnode}
+ luaL_getmetatable(L,"gui.iguitreeviewnode");//{guielement=ud_treeviewnode},m_iguitreeviewnode
+ lua_setmetatable(L,-2);//{treeviewnode}
+
+ return 1;
+}
+
+//iguitreeviewnode:append_child("text"[,"icon"])
+int appendChild(lua_State *L){
+ const char *text_c = "";
+ const char *icon_c = "";
+
+ int nargs = lua_gettop(L);
+ if(nargs > 2){
+ icon_c = lua_tostring(L,-1);//{node},"text","icon"
+ lua_pop(L,1);//{node},"text"
+ }
+
+ text_c = lua_tostring(L,-1);//{node},"text"
+ lua_pop(L,1);//{node}
+
+ printf("before getfield\n");
+ lua_getfield(L,-1,"guielement");//{node},ud_node
+ printf("after getfield\n");
+ IGUITreeViewNode *v = (IGUITreeViewNode*)lua_touserdata(L,-1);//{node},ud_node
+ lua_pop(L,2);//
+
+ int slen = strlen(text_c);
+ wchar_t text_w[slen + 1];
+ mbstowcs(text_w,text_c,slen);
+ text_w[slen] = L'\0';
+
+ int slen2 = strlen(icon_c);
+ wchar_t icon_w[slen2 + 1];
+ mbstowcs(icon_w,icon_c,slen2);
+ icon_w[slen2] = L'\0';
+
+ printf("v is: %p\n",v);
+ IGUITreeViewNode *tvn = v->addChildBack(text_w,icon_w,-1,-1,NULL,NULL);
+
+ lua_newtable(L);//{}
+ lua_pushlightuserdata(L,tvn);//{},ud_TreeViewNode
+ lua_setfield(L,-2,"guielement");//{guielement=treeviewnode}
+ luaL_getmetatable(L,"gui.iguitreeviewnode");//{treeviewnode},m_treeviewnode
+ lua_setmetatable(L,-2);//{treeviewnode}
+
+ return 1;
+}
+
+//iguitreeviewnode:append_child("text"[,"icon"])
+int prependChild(lua_State *L){
+ const char *text_c = "";
+ const char *icon_c = "";
+
+ int nargs = lua_gettop(L);
+ if(nargs > 1){
+ icon_c = lua_tostring(L,-1);//treeviewnode,"text","icon"
+ lua_pop(L,1);//treeviewnode,"text"
+ }
+
+ text_c = lua_tostring(L,-1);//treeviewnode,"text"
+ lua_pop(L,1);//treeviewnode
+
+ printf("Before getfield\n");
+
+ lua_getfield(L,-1,"guielement");//{treeviewnode},ud_element
+ printf("After setfield\n");
+ IGUITreeViewNode *v = (IGUITreeViewNode*)lua_touserdata(L,-1);//{treeviewnode},ud_element
+ lua_pop(L,2);//
+
+ int slen = strlen(text_c);
+ wchar_t text_w[slen];
+ mbstowcs(text_w,text_c,slen);
+
+ int slen2 = strlen(icon_c);
+ wchar_t icon_w[slen2];
+ mbstowcs(icon_w,icon_c,slen2);
+
+ IGUITreeViewNode *tvn = v->addChildFront(text_w,icon_w,-1,-1,NULL,NULL);
+
+ lua_newtable(L);//{}
+ lua_pushlightuserdata(L,tvn);//{},ud_TreeViewNode
+ lua_setfield(L,-2,"guielement");//{guielement=treeviewnode}
+ luaL_getmetatable(L,"gui.iguitreeviewnode");//{treeviewnode},m_treeviewnode
+ lua_setmetatable(L,-2);//{treeviewnode}
+
+ return 1;
+}
+
+
+static const luaL_reg iguitreeview_f[] = {
+ {"newtreeview", newiguitreeview},
+ {0,0},
+};
+
+static const luaL_reg iguitreeview_m[] = {
+ {"getroot", getRootNode},
+ {0,0},
+};
+
+static const luaL_reg iguitreeviewnode_m[] = {
+ {"prepend_child", prependChild},
+ {"append_child", appendChild},
+ {0,0},
+};
+
+void iguitreeview_register(lua_State* L){
+ tL = L;
+
+ luaL_newmetatable(L, "gui.iguitreeview");//{m_iguibutton}
+ lua_newtable(L);//{m_iguibutton},{}
+ luaL_register(L,NULL,iguielement_m);
+ luaL_register(L,NULL,iguitreeview_m);//{m_iguibutton},{}
+ lua_setfield(L,-2,"__index");//{m_iguibutton}
+ lua_pop(L,1);
+
+ luaL_newmetatable(L, "gui.iguitreeviewnode");
+ lua_newtable(L);
+ luaL_register(L,NULL,iguielement_m);
+ luaL_register(L,NULL,iguitreeviewnode_m);
+ lua_setfield(L,-2,"__index");
+ lua_pop(L,1);
+
+ lua_getglobal(L,"gui");
+ luaL_register(L,NULL,iguitreeview_f);
+ lua_pop(L,1);
+}
diff --git a/src/client/lua_api/gui/iguitreeview.hpp b/src/client/lua_api/gui/iguitreeview.hpp
new file mode 100644
index 0000000..22d5e13
--- /dev/null
+++ b/src/client/lua_api/gui/iguitreeview.hpp
@@ -0,0 +1,2 @@
+
+void iguitreeview_register(lua_State* L);
diff --git a/src/client/lua_api/gui/iguiwindow.cpp b/src/client/lua_api/gui/iguiwindow.cpp
index 1c9c5ea..fde8cf1 100644
--- a/src/client/lua_api/gui/iguiwindow.cpp
+++ b/src/client/lua_api/gui/iguiwindow.cpp
@@ -17,9 +17,20 @@ extern "C" {
#include "../../callbackhandeler.hpp"
#include <shared/lua_api/common.hpp>
+/***
+@module gui
+*/
using namespace irr;
using namespace gui;
+/***
+@function newwindow()
+Creates a new gui window .
+@tparam rect dimensions The rectangle to create the window at.
+@tparam string title_text The text to show in the title bar of the window
+@tparam ?iguielement parent The parent element of the window.
+@treturn iguiwindow The window element
+*/
//new({{sx,sy},{ex,ey}},"title"[,{guielement=parent}]) :: {guielement}
static int newiguiwindow(lua_State* L){
IGUIElement* parent = NULL;
diff --git a/src/client/lua_api/gui/simple.cpp b/src/client/lua_api/gui/simple.cpp
index 8e8b237..130240c 100644
--- a/src/client/lua_api/gui/simple.cpp
+++ b/src/client/lua_api/gui/simple.cpp
@@ -52,4 +52,4 @@ int addIGUIButton(lua_State* L){
void add_gui(lua_State* L){
}
-
+blah
diff --git a/src/client/lua_api/io/ifilesystem.cpp b/src/client/lua_api/io/ifilesystem.cpp
new file mode 100644
index 0000000..9d12b22
--- /dev/null
+++ b/src/client/lua_api/io/ifilesystem.cpp
@@ -0,0 +1,106 @@
+#include "ifilesystem.hpp"
+
+using namespace irr;
+using namespace io;
+
+extern IrrlichtDevice* device;
+
+
+// io.list()
+int listfilesin(lua_State *L){
+ IFileSystem *fs = device->getFileSystem();
+ IFileList *fl = fs->createFileList();
+
+ unsigned long fc = fl->getFileCount();
+ unsigned long i;
+ const char *path;
+
+ lua_newtable(L);
+ for(i = 0; i < fc; i++){
+ path = fl->getFileName(i).c_str();
+ lua_pushnumber(L,i + 1);
+ lua_pushstring(L,path);
+ lua_settable(L,-3);
+ }
+
+ return 1;
+}
+
+// io.cd("directory")
+int changedirectory(lua_State *L){
+ IFileSystem *fs = device->getFileSystem();
+ const char *dir = lua_tostring(L,-1);
+ lua_pop(L,1);
+ fs->changeWorkingDirectoryTo(path(dir));
+ return 0;
+}
+
+// io.log("text",level)
+// io.log("text",level[,"hint"])
+int logmessage(lua_State *L){
+ ILogger *log = device->getLogger();
+
+ const char *hint_c = "";
+ const char *text_c = "";
+ int nargs = lua_gettop(L);
+ if(nargs > 2){
+ hint_c = lua_tostring(L,-1);
+ lua_pop(L,1);//"text",level
+ }
+ ELOG_LEVEL ll = (ELOG_LEVEL)lua_tointeger(L,-1);//"text",level
+ lua_pop(L,1);//"text"
+ text_c = lua_tostring(L,-1);//"text"
+ lua_pop(L,1);//
+
+ log->log(text_c,hint_c,ll);
+
+ return 0;
+}
+
+//io.set_log_level(level)
+int setloglevel(lua_State *L){
+ ILogger *log = device->getLogger();
+
+ ELOG_LEVEL ll = (ELOG_LEVEL)lua_tointeger(L,-1);
+ log->setLogLevel(ll);
+
+ return 0;
+}
+
+static const luaL_reg ifilesystem_f[] = {
+ {"log", logmessage},
+ {"set_log_level", setloglevel},
+ {"list", listfilesin},
+ {"cd", changedirectory},
+ {0,0},
+};
+
+static const luaL_reg ifilesystem_m[] = {
+ {0,0},
+};
+
+void ifilesystem_register(lua_State* L){
+
+ luaL_newmetatable(L, "io.ifilesystem");//{m_iguibutton}
+ lua_newtable(L);//{m_iguibutton},{}
+ luaL_register(L,NULL,ifilesystem_m);
+ lua_setfield(L,-2,"__index");//{m_iguibutton}
+
+ lua_pop(L,1);
+ printf("set io global\n");
+ lua_getglobal(L,"io");//{io}
+ luaL_register(L,NULL,ifilesystem_f);
+
+ lua_pushnumber(L,ELL_DEBUG);
+ lua_setfield(L,-2,"LOG_DEBUG");
+ lua_pushnumber(L,ELL_INFORMATION);
+ lua_setfield(L,-2,"LOG_INFO");
+ lua_pushnumber(L,ELL_WARNING);
+ lua_setfield(L,-2,"LOG_WARN");
+ lua_pushnumber(L,ELL_ERROR);
+ lua_setfield(L,-2,"LOG_ERROR");
+ lua_pushnumber(L,ELL_NONE);
+ lua_setfield(L,-2,"LOG_NONE");
+
+ lua_pop(L,1);//
+}
diff --git a/src/client/lua_api/io/ifilesystem.hpp b/src/client/lua_api/io/ifilesystem.hpp
new file mode 100644
index 0000000..9a72120
--- /dev/null
+++ b/src/client/lua_api/io/ifilesystem.hpp
@@ -0,0 +1,13 @@
+#ifndef __H_ifilesystem
+#define __H_ifilesystem
+
+extern "C" {
+ #include <lua.h>
+ #include <lauxlib.h>
+ #include <lualib.h>
+}
+#include <irrlicht.h>
+
+void ifilesystem_register(lua_State* L);
+
+#endif
diff --git a/src/client/lua_api/load_gui.cpp b/src/client/lua_api/load_gui.cpp
index c5d5dd1..fc96a2d 100644
--- a/src/client/lua_api/load_gui.cpp
+++ b/src/client/lua_api/load_gui.cpp
@@ -23,6 +23,7 @@ extern "C" {
#include "gui/iguicolorselector.hpp"
#include "gui/iguifiledialog.hpp"
#include "gui/iguispinbox.hpp"
+#include "gui/iguitreeview.hpp"
#include "../callbackhandeler.hpp"
#include "guiparts.hpp"
@@ -68,7 +69,7 @@ void load_guifuncs(lua_State* L){
iguicolorselector_register(L);
iguidialog_register(L);
iguispinbox_register(L);
-
+ iguitreeview_register(L);
iguieditbox_register(L);
lua_pushcfunction(L,screenwidth);
diff --git a/src/client/lua_api/load_io.cpp b/src/client/lua_api/load_io.cpp
new file mode 100644
index 0000000..6b368c4
--- /dev/null
+++ b/src/client/lua_api/load_io.cpp
@@ -0,0 +1,11 @@
+#include "load_io.hpp"
+#include "io/ifilesystem.hpp"
+#include <irrlicht.h>
+
+void load_iofuncs(lua_State* L){
+
+ //lua_newtable(L);
+ //lua_setglobal(L,"io");
+
+ ifilesystem_register(L);
+}
diff --git a/src/client/lua_api/load_io.hpp b/src/client/lua_api/load_io.hpp
new file mode 100644
index 0000000..47ac60a
--- /dev/null
+++ b/src/client/lua_api/load_io.hpp
@@ -0,0 +1,11 @@
+#ifndef __H_loadio
+#define __H_loadio
+extern "C" {
+ #include <lua.h>
+ #include <lauxlib.h>
+ #include <lualib.h>
+}
+
+void load_iofuncs(lua_State* L);
+#endif
+
diff --git a/src/client/lua_api/scene/imesh.cpp b/src/client/lua_api/scene/imesh.cpp
index f3b5bc8..c6ced65 100644
--- a/src/client/lua_api/scene/imesh.cpp
+++ b/src/client/lua_api/scene/imesh.cpp
@@ -16,6 +16,9 @@ extern "C" {
#include "igeneric.hpp"
#include <shared/lua_api/common.hpp>
+/***
+@module scene
+*/
using namespace irr;
using namespace scene;
using namespace core;