This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <lua.h> | |
#include <lualib.h> | |
#include <lauxlib.h> | |
#include <stdarg.h> | |
#include <string.h> | |
#define ERRLOG 1 | |
#define MSGTABLE 2 | |
#define RETOP 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Unpack lua table create by { ... } | |
#define LUA_LIB | |
#include <lua.h> | |
#include <lauxlib.h> | |
static int | |
max_index(lua_State *L, int index) { | |
int n = lua_rawlen(L, index); | |
if (n == 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
net=5.422477ms,cluster=91.399046ms,cpu=323.263431ms,latency=5.447901ms,time=425.532855ms | |
login1:00000063 122.286771ms trace gm | |
login1:00000063 102.904420ms(net=3.207950ms,cluster=0.250590ms,cpu=3.580064ms,time=7.038604ms) call : @./service/agent/player/war_base.lua:363 @./service/agent/player/war_base.lua:130 @./service/agent/agent_lock.lua:62 | |
login1:00000009 3.568610ms request | |
login1:00000009 3.458540ms(time=0.250590ms) sleep : @./skynet/lualib/skynet/socketchannel.lua:374 @./skynet/service/clusterd.lua:147 @./skynet/service/clusterd.lua:252 | |
center:0000005d 0.250590ms tracecall begin | |
center:00000056 0.069562ms request | |
center:00000056 response | |
center:0000005d tracecall end | |
login1:00000009 0.011454ms resume |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// C module for data stack manager | |
// See below for lua lib wrapper | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdio.h> | |
#define MINCAP 128 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local core = require "ecs.core" | |
local ecs = {} | |
local entities = {} -- all Entities, eid -> entity | |
local entity_id = 0 | |
ecs.entities = entities | |
-- cset: component set | |
local cset = { __mode = "kv" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local shadowcopy = {} | |
local weak = { __mode = "k" } | |
local NIL = {} | |
local queue = setmetatable({}, weak) -- object -> queue | |
local map = setmetatable({}, weak) -- copy -> { object = obj, values = {} } | |
local direct_mt = { | |
__index = function(t,k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local pdx = {} | |
do | |
local lpeg = require "lpeg" | |
local P = lpeg.P | |
local S = lpeg.S | |
local R = lpeg.R | |
local C = lpeg.C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc -o clonetable.so --shared lclonetable.c -I$(LUAINCLUDE) | |
#include <lobject.h> | |
#include <ltable.h> | |
#include <lgc.h> | |
#include <lstate.h> | |
#include <lauxlib.h> | |
#include <lualib.h> | |
#include <lua.h> | |
#include <string.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// My version of pimpl (cloudwu@gmail.com) | |
// See http://en.cppreference.com/w/cpp/language/pimpl | |
#include <iostream> | |
// interface (widget.h) | |
class widget { | |
struct impl; | |
public: | |
static widget* create(int); // replacement of new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define HEIGHT 24 | |
#define STB_TRUETYPE_IMPLEMENTATION | |
#define STBTT_STATIC | |
// gcc -Wall -Wno-unused-function -g ttfont.c -o ttfont.exe | |
// https://github.com/nothings/stb/blob/master/stb_truetype.h | |
#include "stb_truetype.h" |