func luaToString(L *lua.State, idx int) string {
	switch L.Type(idx) {
	case lua.LUA_TNUMBER:
		L.PushValue(idx)
		defer L.Pop(1)
		return L.ToString(-1)
	case lua.LUA_TSTRING:
		return L.ToString(-1)
	case lua.LUA_TBOOLEAN:
		b := L.ToBoolean(idx)
		if b {
			return "true"
		}
		return "false"
	case lua.LUA_TNIL:
		return "nil"
	}
	return fmt.Sprintf("%s: %p", L.LTypename(idx), L.ToPointer(idx))
}
func luaToString(L *lua.State, idx int) string {
	switch L.Type(idx) {
	case lua.LUA_TNUMBER:
		L.PushValue(idx)
		defer L.Pop(1)
		return L.ToString(-1)
	case lua.LUA_TSTRING:
		return L.ToString(-1)
	case lua.LUA_TBOOLEAN:
		b := L.ToBoolean(idx)
		if b {
			return "true"
		}
		return "false"
	case lua.LUA_TNIL:
		return "nil"
	}
	return fmt.Sprintf("%s: %p", L.LTypename(idx), L.ToPointer(idx))
}
func luaToString ( L * lua . State , idx int ) string { switch L . Type ( idx ) { case lua . LUA_TNUMBER : L . PushValue ( idx ) defer L . Pop ( 1 ) return L . ToString ( - 1 ) case lua . LUA_TSTRING : return L . ToString ( - 1 ) case lua . LUA_TBOOLEAN : b := L . ToBoolean ( idx ) if b { return " " } return " " case lua . LUA_TNIL : return " " } return fmt . Sprintf ( " " , L . LTypename ( idx ) , L . ToPointer ( idx ) ) }
// Lua 5.1 'lua_tostring' function only supports string and numbers. Extend it for internal purposes.
// From the Lua 5.3 source code.
Lua 5 . 1 lua_tostring function only supports string and numbers . Extend it for internal purposes . From the Lua 5 . 3 source code .