make working classes && add vscode config && add lua submodule
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
#include "systemColors.h"
|
||||
#include "debug.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
static int syscalls_SystemColors_m_index;
|
||||
|
||||
int syscalls_newSystemColors(lua_State* L)
|
||||
{
|
||||
ksys_colors_table_t* colorsTable = malloc(sizeof(ksys_colors_table_t));
|
||||
ksys_colors_table_t* colorsTable = syscalls_pushSystemColors(L);
|
||||
|
||||
colorsTable->frame_area = luaL_optinteger(L, 1, 0);
|
||||
colorsTable->grab_bar = luaL_optinteger(L, 2, 0);
|
||||
@@ -17,13 +21,13 @@ int syscalls_newSystemColors(lua_State* L)
|
||||
colorsTable->work_graph = luaL_optinteger(L, 9, 0);
|
||||
colorsTable->work_text = luaL_optinteger(L, 10, 0);
|
||||
|
||||
syscalls_pushSystemColors(L, colorsTable);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int syscalls_indexSystemColors(lua_State* L)
|
||||
{
|
||||
DEBUG_LINE("system colors index");
|
||||
|
||||
const ksys_colors_table_t* t = (const ksys_colors_table_t*)luaL_checkudata(L, 1, syscalls_SystemColors_metatable_name);
|
||||
|
||||
const char* index = luaL_checkstring(L, 2);
|
||||
@@ -150,35 +154,41 @@ static int sycalls_gcSystemColors(lua_State* L)
|
||||
{
|
||||
ksys_colors_table_t* t = luaL_checkudata(L, 1, syscalls_SystemColors_metatable_name);
|
||||
free(t);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
ksys_colors_table_t* syscalls_pushSystemColors(lua_State* L)
|
||||
{
|
||||
DEBUG_LINE("push system colors table");
|
||||
|
||||
ksys_colors_table_t* colorsTable = lua_newuserdata(L, sizeof(ksys_colors_table_t));
|
||||
luaL_setmetatable(L, syscalls_SystemColors_metatable_name);
|
||||
|
||||
return colorsTable;
|
||||
}
|
||||
|
||||
|
||||
static const luaL_Reg syscalls_SystemColors_m[] = {
|
||||
{"__index", syscalls_indexSystemColors},
|
||||
{"__newindex", syscalls_newindexSystemColors},
|
||||
{"__eq", sycalls_eqSystemColors},
|
||||
{NULL, NULL} };
|
||||
|
||||
void syscalls_pushSystemColors(lua_State* L, ksys_colors_table_t* colorsTable)
|
||||
{
|
||||
*(ksys_colors_table_t**)lua_newuserdata(L, sizeof(ksys_colors_table_t)) = colorsTable;
|
||||
|
||||
luaL_newlibtable(L, syscalls_SystemColors_m);
|
||||
luaL_setfuncs(L, syscalls_SystemColors_m, 0);
|
||||
|
||||
lua_setmetatable(L, -2);
|
||||
}
|
||||
|
||||
{"__gc", sycalls_gcSystemColors},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static const luaL_Reg syscalls_SystemColors_lib[] = {
|
||||
{"new", syscalls_newSystemColors},
|
||||
{NULL, NULL} };
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
void syscalls_register_SystemColors(lua_State* L)
|
||||
{
|
||||
luaL_newlib(L, syscalls_SystemColors_lib);
|
||||
lua_setfield(L, -2, syscalls_SystemColors_name);
|
||||
lua_setfield(L, -2, "SystemColors");
|
||||
|
||||
luaL_newlibtable(L, syscalls_SystemColors_m);
|
||||
luaL_newmetatable(L, syscalls_SystemColors_metatable_name);
|
||||
luaL_setfuncs(L, syscalls_SystemColors_m, 0);
|
||||
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user