#! /bin/sh
echo $0
echo $1
echo $@
echo $#
andy$./test.sh 1 2 3 4
./test.sh
1
1 2 3 4
4
print(select('#', ...))
print(select(2, ...))
local arg = select(2, ...)
print("arg=" .. arg)
andy$ lua test.lua 1 2 3
3
2 3
arg=2
for k, v in pairs(table) do
print("key = " .. k .. ", value = " .. v)
end
//c++11 get elapsed time
#include <chrono>
auto last_time = std::chrono::steady_clock::now();
auto now = std::chrono::steady_clock::now();
auto elapsed_time = std::chrono::duration_cast<std::chrono::milliseconds>(now - last_time);
if(elapsed_time.count() > 100) {//do sth}
#include <sstream>
std::ostringstream os;
os << memory.uMemoryUsed;
obj["uMemoryUsed"] = os.str();
//os.clear(); this method doesn't clear the buffer... clear : clears error and eof flags
os.str("");
os << memory.uMemoryTotal;
obj["uMemoryTotal"] = os.str();
os.str("");
os << memory.uProcessMemroyUsed;
obj["uProcessMemroyUsed"] = os.str();